Search code examples
asp.netperformancestatic-files

Tips for serving static files faster, like JavaScripts, CSS and images


I would like to get some tips from our SO users about serving static files on a website — like JavaScript, CSS, images and Flash files — faster. Any useful tips?


Solution

  • The best tip I can give you is: buy Steve Sounder's book High Performance Web Sites which is full of easy-to-follow tips. On the account of static images: use a content delivery network (CDN), which means: just place your static content on another server, on another (sub) domain and you have the best performance you can have for static content.

    The advantages are: no cookies send back and forth (this accounts for much overhead!), no other HTTP overhead, good timeouts, solid performance when using external CDN and your own server gets much less trafic. There are many commercial (like Amazon S3), but also free, CDN suppliers.

    Some less-important but still valuable of tips:

    Note: StackOverflow is a fine example website that follows all these tips and download YSlow to test your own website.