# Fragment cache hit is super slow every two times

**URL:** <https://www.ruby-forum.com/t/fragment-cache-hit-is-super-slow-every-two-times/154151>\
**Category:** Rails\
**Created:** [November 25, 2008, 10:33pm UTC](https://www.ruby-forum.com/t/fragment-cache-hit-is-super-slow-every-two-times/154151 "2008-11-25T22:33:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [November 25, 2008, 10:33pm UTC](https://www.ruby-forum.com/t/fragment-cache-hit-is-super-slow-every-two-times/154151/1 "2008-11-25T22:33:22Z")

</div>

Hi,

I have a piece of html that I fragment cache. For a very strange reason  
every two times I request the page, rendering the fragment cache takes a  
lot of time.

Example:

1. I request index page, rendering takes 300ms
2. I request again index page, rendering takes 1300ms
3. I request again index page, rendering takes 300ms
4. and so on

Where could that come from???

---

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [November 25, 2008, 10:58pm UTC](https://www.ruby-forum.com/t/fragment-cache-hit-is-super-slow-every-two-times/154151/2 "2008-11-25T22:58:42Z")

</div>

Fernando P. wrote:

> Hi,
> 
> I have a piece of html that I fragment cache. For a very strange reason  
> every two times I request the page, rendering the fragment cache takes a  
> lot of time.
> 
> Example:
> 
> 1. I request index page, rendering takes 300ms
> 2. I request again index page, rendering takes 1300ms
> 3. I request again index page, rendering takes 300ms
> 4. and so on
> 
> Where could that come from???

I try to do some profiling with script/performance/request, but it seems  
broken, because when it has finished making requests, it never renders  
the results. In Rails 2.1.1 it worked fine though.

Has anyone encountered this problem?

---

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [November 25, 2008, 11:12pm UTC](https://www.ruby-forum.com/t/fragment-cache-hit-is-super-slow-every-two-times/154151/3 "2008-11-25T23:12:40Z")

</div>

> I try to do some profiling with script/performance/request, but it seems  
> broken, because when it has finished making requests, it never renders  
> the results. In Rails 2.1.1 it worked fine though.
> 
> Has anyone encountered this problem?

I had forgotten to use production environment for the profiling, now it  
renders the results.
