Since my last post I have made important changes to how images (mostly thumbnails) are serve on myVidster. Stated in my last post I divided the image workload between the new image server and the master server. I really did not like this setup because the master server should not be wasting disk I/O on image hosting.
My first attempt was to setup the image server to handle the entire load. This solution would have work if I was running RAID on the server, but I was not. It only took a few minutes before the server's hard disk was overwhelm. When you run into the dreaded disk I/O bottleneck you have two options which are to upgrade your hardware (SSD or RAID) or memory caching.
If you have been keeping up with my blog, you will know that I try to use in memory caching whenever possible so I did some research and learn about using a reverse proxy for image caching. For the reverse proxy I decided to give Varnish Cache a try, which was recommended by a developer/friend.
Setting up Varnish has straight forward the only catch was that I needed to disable cookies (remove req.http.Cookie) so that the images were always cached. Technicality the image server is now a web application accelerator with the task of caching and serving images.
As for performance, currently I am getting a hit rate around 85% with 400-500 requests per second. CPU load hovering around 10% which gives the server lots of room for handling more traffic when needed. Overall I am very pleased with Varnish's caching performance and would recommend this solution to those who want to accelerate image serving and to reduce disk I/O.
For the curious here is a list of memory caching solutions that myVidster uses.
Alternative PHP Cache (APC) opcode caching for PHP
Memcached for user session caching
Take care everyone and keep collecting!