loading localhost:3000/projectszzzzz takes forever to load > 2min

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

loading localhost:3000/projectszzzzz takes forever to load > 2min

tommaso159
i have roughly 30 resources in routes, 10 scopes, a few nested resources.  how can i find out what the problem is?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMcMrB1ZLtn_v76RbW33vV1N-M%2B5Xypt3u1H-FBA342jDg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: loading localhost:3000/projectszzzzz takes forever to load > 2min

Walter Lee Davis
Turn your logging level up to debug, and watch the queries that are being generated by ActiveRecord in order to load this route. Are you seeing multiple requests to the database, or one big honking joined query? Sometimes using joins is slower than eager loading (which generally loads in two or more queries). But for slow, nothing beats an N+1 query, where you load a bunch of objects, then make a separate query or more per object to gather associated records from other related models.

Without any more details about your setup (running on a Raspberry Pi? or bouncing your database connection off the moon?) it's impossible to say. But start there.

Walter

> On May 23, 2019, at 3:02 PM, tom <[hidden email]> wrote:
>
> i have roughly 30 resources in routes, 10 scopes, a few nested resources.  how can i find out what the problem is?
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMcMrB1ZLtn_v76RbW33vV1N-M%2B5Xypt3u1H-FBA342jDg%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/67541D5B-D756-40C3-AC98-476C46D351BD%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: loading localhost:3000/projectszzzzz takes forever to load > 2min

Ariel Juodziukynas
In reply to this post by tommaso159
Check the log, it tells you the time spent on each query to the database:

User Load (1.0ms)  SELECT  `users`.* FROM `users` WHERE `users`.`id` = 201356 LIMIT 1

Note that "1.0ms"

It also tells you how log it took to render the each view and the totals:

  Rendered shared/_menu.html.slim (74.7ms)
  Rendered shared/_footer.html.slim (251.1ms)
  Rendered shared/_flash_modal.html.slim (2.7ms)
Completed 200 OK in 48109ms (Views: 45777.0ms | ActiveRecord: 1670.4ms)


You can also use gems like miniprofiler or bullet (for N+1 Queries) that shows you some of that information in a friendlier way



El jue., 23 may. 2019 a las 16:03, tom (<[hidden email]>) escribió:
i have roughly 30 resources in routes, 10 scopes, a few nested resources.  how can i find out what the problem is?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMcMrB1ZLtn_v76RbW33vV1N-M%2B5Xypt3u1H-FBA342jDg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAPS3bcDiBUqm9eAJ71wq4Y4LM4sxatSQnTtjyBpeXVE-Jk-uow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: loading localhost:3000/projectszzzzz takes forever to load > 2min

Ariel Juodziukynas
*It also tells you how long it took to render each view and the totals:

El jue., 23 may. 2019 a las 16:55, Ariel Juodziukynas (<[hidden email]>) escribió:
Check the log, it tells you the time spent on each query to the database:

User Load (1.0ms)  SELECT  `users`.* FROM `users` WHERE `users`.`id` = 201356 LIMIT 1

Note that "1.0ms"

It also tells you how log it took to render the each view and the totals:

  Rendered shared/_menu.html.slim (74.7ms)
  Rendered shared/_footer.html.slim (251.1ms)
  Rendered shared/_flash_modal.html.slim (2.7ms)
Completed 200 OK in 48109ms (Views: 45777.0ms | ActiveRecord: 1670.4ms)


You can also use gems like miniprofiler or bullet (for N+1 Queries) that shows you some of that information in a friendlier way



El jue., 23 may. 2019 a las 16:03, tom (<[hidden email]>) escribió:
i have roughly 30 resources in routes, 10 scopes, a few nested resources.  how can i find out what the problem is?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMcMrB1ZLtn_v76RbW33vV1N-M%2B5Xypt3u1H-FBA342jDg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAPS3bcDh5ZQxw%3DAUXvT42pFXGF1rauqk4Kb%2BXEmFaLFMbZ5geg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.