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!


Anna university said...

OMG, but how did you get it, - any way thanks for sharing :) anna university results 2017

Edward Cross said...

It was a wonderful chance to visit this kind of site and I am happy to know. thank you so much for giving us a chance to have this opportunity! I will be back soon for updates.custom essay writers

Oliver Maurice said...

Take a look here for some information about phone gps locators and monitoring systems that allow its users to track someone's device location via the world. That's great!

ernestiriveraas said...

In the long run, after total transfer, your backup is total. Official Page If you have a Jailbroken apple iphone after that you could make use of Cydia App.