Skip to content

Instantly share code, notes, and snippets.

@troelskn
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save troelskn/fca41034ab3ebed4f507 to your computer and use it in GitHub Desktop.
Save troelskn/fca41034ab3ebed4f507 to your computer and use it in GitHub Desktop.
identity_cache benchmark
I benchmarked identity_cache with memcached vs. default active_record against mysql.
Setup is running on AWS, same availability zone. I used RDS (Multi AZ setup) for MySql and ElastiCache for memcached. The test server is on EC2. Instance types are m3.large for MySql, m3.xlarge for EC2 and r3.large for memcached.
The database is a copy of our production db. The products table holds about 1.4M entries.
The cache has been pre-heated with all 1.4M entries prior to the test.
During the test, I ran 10000 fetches:
user system total real
mysql: 5.540000 0.500000 6.040000 ( 9.502318)
memcached: 4.300000 0.580000 4.880000 ( 6.506664)
Same test, with two associations embedded (both of them are one-to-many):
user system total real
mysql: 22.030000 1.340000 23.370000 ( 33.533370)
memcached: 9.850000 0.980000 10.830000 ( 12.348103)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment