How to build an image web server?

Definitely look around for a good delivery service. Akamai is the best known.

if you really want to do it on your own, forget about Apache/IIS. much more appropriate are 'light' webservers. Two very good are lighthttp and NginX (wiki). NginX in particular, has a really solid performance.

Edit: Content Distribution Networks (CDNs) have flourished in the last few years, and it's much easier to find easier and cheaper ones. In particular, it's quite simple to put your static content in Amazon's S3 and use CloudFront.


If you want to design the fastest static file webserver with lowest latency, here's how I would do it.

  1. Use an event loop to detect which sockets are ready
  2. Put those sockets in a queue
  3. Create a stack of threads to deal with sockets (1 for each core). When they finish, put them back on the stack.
  4. Assign work to threads.
  5. Cache all image files in memory.

This is essentially what IO completion ports are minus the caching of files. This model is available in Windows and Solaris.

http://technet.microsoft.com/en-us/sysinternals/bb963891.aspx

alt text
(source: microsoft.com)

Tags:

Image