Memcached on skinnyCorp
Posted on Mar 23, 2007
In the last year or so Threadless has grown insanely. When I started in 2005, we had around 2 servers and a bundle of downtime. Now, just a year and a half later we have an assload of servers and haven’t had any load based downtime in almost 6 months. Its awesome. We have really been striving to keep our server infrastructure two steps ahead of our traffic. It really makes a difference when we get slammed and our servers don’t even grown. I love it.
So part of my daily routine of making sure we continue on this path is to constantly keep on the lookout for cool tech that will make our shit FAST. The newest one is memcached. a opensource product made by the danga interactive. Danga is the company that started livejournal and created a bunch of neat tools for making scalable websites.
I am using it with PHP and our caching class. It is pretty easy to use. We set up a memcached box with a bundle of ram, ran a couple memcached servers on it and then hook into it with the PHP pecl extension for memcached. The speed of the cache is madness. We tested it with a bunch of queries and were really impressed with the increase in speed. its nuts.
I have released a screen capture of our test here: http://flickr.com/photo_zoom.gne?id=430540094. The test results are thus:
The test was simply executing a largish query and caching it, then reading the results from the cache, then clearing the cached results.
We are using a modified object cache I made a minute ago. It is based off my ObjectBase class but made to emulate memcached. So it will work with or without a memcached server, which allows us to roll out the infrastructure and then just turn on the memcached servers for better performance. You can check out the source here. I will be releasing it once its a bit more solid.
I can’t wait until we integrate it with all of our sites. I will be so happy and our sites will be rather snappy!