# Rails 2.3 memcache performance drop

**URL:** <https://discuss.rubyonrails.org/t/rails-2-3-memcache-performance-drop/41332>\
**Category:** rubyonrails-talk\
**Created:** [April 8, 2009, 3:52am UTC](https://discuss.rubyonrails.org/t/rails-2-3-memcache-performance-drop/41332 "2009-04-08T03:52:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Clinton1](https://avatars.discourse-cdn.com/v4/letter/c/e8c25b/32.png) [@Clinton1](https://discuss.rubyonrails.org/u/Clinton1)\
**Post date:** [April 8, 2009, 3:52am UTC](https://discuss.rubyonrails.org/t/rails-2-3-memcache-performance-drop/41332/1 "2009-04-08T03:52:28Z")

</div>

After much effort I upgraded our fairly large Rails app from 2.1 to 2.3. After deployment yesterday I noticed an across the board increase in response times. It seems that every call to memcache now takes 10x longer than before. Here are some example numbers from my development log (below), with memcache running locally. We see similar scale of performance drop in production as well - average memcache call before 2ms, now 20ms. It adds up to a significant hit.

Before Rails 2.3 upgrade:

Cached fragment hit: views/homepage\_recent\_blog\_posts (0.00043) Cached fragment hit: views/homepage\_active\_threads (0.00033) Cached fragment hit: views/homepage\_weekly\_feature (0.00029) Cached fragment hit: views/homepage\_recent\_approved\_items (0.00036) Cached fragment hit: views/homepage\_popular\_items (0.00037) Cached fragment hit: views/number\_of\_members (0.00032)

After Rails 2.3 upgrade:

Cached fragment hit: views/homepage\_recent\_blog\_posts (3.2ms) Cached fragment hit: views/homepage\_active\_threads (3.5ms) Cached fragment hit: views/homepage\_weekly\_feature (2.9ms) Cached fragment hit: views/homepage\_recent\_approved\_items (2.8ms) Cached fragment hit: views/homepage\_popular\_items (3.1ms) Cached fragment hit: views/number\_of\_members (6.7ms)

Before I start delving into the memcache internals in Rails 2.3, has anyone else experienced this degradation on their apps? Is there a magic 'make it fast again' switch that I can flick?

---

<div class="post-metadata">

**Author:** ![Ryan\_Allen](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@Ryan\_Allen](https://discuss.rubyonrails.org/u/Ryan_Allen)\
**Post date:** [April 9, 2009, 3:14am UTC](https://discuss.rubyonrails.org/t/rails-2-3-memcache-performance-drop/41332/2 "2009-04-09T03:14:23Z")

</div>

It turned out that the bundled memcache client that came with ActiveSupport (1.6.5) was, for some reason, \_much\_ slower than the one we were using before the Rails 2.3 upgrade (we were using fiveruns- memcache-client (1.5.0.5), the one that has retries built in).

We've replaced the bundled memcache client with our old one, and it performs much better.

---

<div class="post-metadata">

**Author:** ![erik2](https://avatars.discourse-cdn.com/v4/letter/e/c0e974/32.png) [@erik2](https://discuss.rubyonrails.org/u/erik2)\
**Post date:** [May 24, 2009, 5:07pm UTC](https://discuss.rubyonrails.org/t/rails-2-3-memcache-performance-drop/41332/3 "2009-05-24T17:07:05Z")

</div>

Hi- &nbsp;&nbsp;Could tell me how you replaced it? I just installed the newest gem 1.7.2 and would like to use it with rails. What's the procedure to remove the bundled gem? Thanks. Erik

---

<div class="post-metadata">

**Author:** ![Con](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@Con](https://discuss.rubyonrails.org/u/Con)\
**Post date:** [May 24, 2009, 10:38pm UTC](https://discuss.rubyonrails.org/t/rails-2-3-memcache-performance-drop/41332/4 "2009-05-24T22:38:26Z")

</div>

I was told by Mike Perham that Rails 2.3+ will automatically use any memcache-client

gem you have greater than 1.6.4.

Good luck,

-Conrad
