Memcache

April 13, 2014

I was having performace issue in 2008 on my websites, the traffic was getting hight and I had no budget the get more servers.

I already used an architecture with squid as a load balancer, and mysql slaves severs.

With no budget, I had to find a way to improve the load performace with the database’s size and the traffic growing every days.

I found sphinx search index and Memcache.

I choosed Memcache by looking what other website used. I found that Facebook was using Memcache. Memcache is quiet simple, it’s just a daemon with keys and values that you can read or write.

  • I modified my php Sql classes by storing most of mysql queries in memcache with a simple md5 sum of the SQL selects.
  • I did the same for my object classes, I know the arguments of my class product->load(args), now I can store a full unserialized object, the key is an md5 of the unserialized arguments.
Bingo, I was able to share a sql and php object cache between all my slaves.

posted in Developer, System Administrator by nico

Follow comments via the RSS Feed| Trackback URL