0

I am in the process of implementing basic remote caching on Rails 4, and I am having trouble determining if it is truly working.

My setup is as follows:

  • Amazon EC2 instances for web/app/db layers plus a specific ec2 instance for memcached.
  • RoR with Nginx, Unicorn and MySQL
  • Dalli gem (default with Rails 4)
  • Capistrano gem for deployment
  • New Relic for metric gathering
  • I also defined my own "staging" rails_env that deploys to AWS

My question: I have been changing the caching configurations inside my own /config/environments/staging.rb (since I defined my own rails_env) and I am not seeing any significant differences in performance with caching on and off.

Ex. With caching on, a page would take ~200ms on initial load and ~15ms on subsequent loads.

Following the RoR guide, I turned off caching by setting

config.action_controller.perform_caching = false

config.cache_store = :null_store

which was

config.cache_store = :mem_cache_store, "www.mymemcachedserver.com"

before.

With caching off, I was expecting the same pages to take ~200ms on each load, but I am seeing the exact same numbers (200ms before, 15ms after). Is there something that I'm missing? Did I have caching working in the first place?

I also tried directly accessing the site from the app layer (sans CSS & other assets) and got similar results - so is there other sources of caching that I am missing? Could it be related to the database or even my browser caching previous pages (ie Chrome, Firefox)?

Thanks in advance!

Community
  • 1
  • 1
  • Does your code use cache blocks? Maybe you have not put anything in the cache? http://guides.rubyonrails.org/caching_with_rails.html – house9 Jan 07 '14 at 16:23
  • http://www.appneta.com/blog/russian-doll-caching/ – house9 Jan 07 '14 at 16:26
  • If your memcached server is located on a remote machine your server still has to wait for the response to come back instead of rendering it right away. – TheRusskiy Jan 07 '14 at 17:16
  • thanks house, I'm going to play around with the fragment caching. I guess one of my other main question is what else is caching these results? what is lowering the subsequent load times of each page if I didn't have caching implemented at all? could it be the rails process itself? (I'm also using unicorn as well) – user2403366 Jan 07 '14 at 17:29

0 Answers0