# What is taking so long to display this page?

**URL:** <https://www.ruby-forum.com/t/what-is-taking-so-long-to-display-this-page/163984>\
**Category:** Rails\
**Created:** [March 26, 2009, 5:32pm UTC](https://www.ruby-forum.com/t/what-is-taking-so-long-to-display-this-page/163984 "2009-03-26T17:32:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![skirkpatrick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/73ab20/32.png) [@skirkpatrick](https://www.ruby-forum.com/u/skirkpatrick)\
**Post date:** [March 26, 2009, 5:32pm UTC](https://www.ruby-forum.com/t/what-is-taking-so-long-to-display-this-page/163984/1 "2009-03-26T17:32:47Z")

</div>

I have a page that does a lot of calculations…that for some reason  
takes 19 seconds to load when running in my development environment.

Looking at my logs I can see Rendering took .8 seconds and the DB took  
2.38 seconds:

Completed in 19.81708 (0 reqs/sec) | Rendering: 0.80910 (4%) | DB:  
2.38379 (12%) | 200 OK [[http://wldev.kuliksco.com/compounds](http://wldev.kuliksco.com/compounds)]

where is the rest of the time coming from? is this time when the cpu is  
chugging away doing calculations? I don’t think it would be a bandwidth  
issue since I’m testing from the same router/subnet.

---

<div class="post-metadata">

**Author:** ![skirkpatrick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/73ab20/32.png) [@skirkpatrick](https://www.ruby-forum.com/u/skirkpatrick)\
**Post date:** [March 26, 2009, 6:08pm UTC](https://www.ruby-forum.com/t/what-is-taking-so-long-to-display-this-page/163984/2 "2009-03-26T18:08:48Z")

</div>

On Mar 26, 2009, at 12:32 PM, Scott K. wrote:

> ## cpu is chugging away doing calculations? I don’t think it would be a bandwidth issue since I’m testing from the same router/subnet.

Yes, the remaining 16.62419 seconds are your code heating up the CPU.  
(Of course, not all of what falls outside of Rendering and DB is  
necessarily code written by you, but you’d have to instrument your  
code to find out more details.)

You can try New Relic’s Rails Performance Monitor [1] to find out some  
of those details.

[1] [http://newrelic.com/get-RPM.html](http://newrelic.com/get-RPM.html)

-Rob

Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![skirkpatrick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/73ab20/32.png) [@skirkpatrick](https://www.ruby-forum.com/u/skirkpatrick)\
**Post date:** [March 26, 2009, 8:37pm UTC](https://www.ruby-forum.com/t/what-is-taking-so-long-to-display-this-page/163984/3 "2009-03-26T20:37:19Z")

</div>

Rob B. wrote:

> You can try New Relic’s Rails Performance Monitor [1] to find out some  
> of those details.
> 
> [1] [http://newrelic.com/get-RPM.html](http://newrelic.com/get-RPM.html)
> 
> -Rob
> 
> Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
> removed\_email\_address@domain.invalid

thanks rob! i just installed the plugin and I can see where all the cpu  
is going.

---

<div class="post-metadata">

**Author:** ![skirkpatrick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/73ab20/32.png) [@skirkpatrick](https://www.ruby-forum.com/u/skirkpatrick)\
**Post date:** [March 27, 2009, 10:06pm UTC](https://www.ruby-forum.com/t/what-is-taking-so-long-to-display-this-page/163984/4 "2009-03-27T22:06:01Z")

</div>

Denis H. wrote:

> And where was it going? 😉
> 
> dwh

i had some cpu intensive code to validate the items on the page and i  
screwed up the query so it was running the code on all 7000 rows in the  
table instead of just the 50 displayed on current page. doh!

---

<div class="post-metadata">

**Author:** ![skirkpatrick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/73ab20/32.png) [@skirkpatrick](https://www.ruby-forum.com/u/skirkpatrick)\
**Post date:** [March 26, 2009, 8:55pm UTC](https://www.ruby-forum.com/t/what-is-taking-so-long-to-display-this-page/163984/5 "2009-03-26T20:55:09Z")

</div>

And where was it going? 😉

dwh
