Monday, April 30, 2012

Image Server Revisited

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!

Tuesday, April 24, 2012

I'm Back, Actually I Never Left

Greetings Vidsters and guests! Here is a development update for the curious.

I recently added a new server to the family.  This one will act as a image server to offload some of the image hosting that the master server has been handling.  Also on my master server I had an under utilize RAID disk, so I move the most of the images (ie video thumbnails) to RAID.  These updates have reduce server load during peak hours by around 30%.

Also in the works is an automated system for removing video bookmarks that no longer play.

On a personal note, I was in San Fransisco for 2 weeks for business and I love it!  What I love the most was not the city, but the people.  They are diverse, creative and all around good people.  Living in the Midwest you get good people but can fall short on the diversity and creativity.  Not trying to bash my own home, oh wait I will ;).  Anyway there is a possibility that I might move out there, if I do watch out, because I am bringing a storm with me!

Take care and keep collecting