Thursday, September 22, 2011

Fundamentals of WPO

There are two fundamental factors (action items) for Web Performance Optimization (WPO), request number and data size. There are top rules and plenty of tools to assist these two optimization. This is common sense and very straightforward to understand the importance. One metaphor about moving in real life, if you can throw away what you don't necessarily need, and keep your belongs to minimum say 1 U-haul truck can hold, then you can make the move fast because you only need 1 round trip with minimum stuff.

Reduce Http request - Send it as infrequently as possible
Http round trip is expensive esp. with a long RTT, or for new http connection. Reducing http request can be achieved using the following:
  • Merge static resources (CSS, JS, Image)
  • Add Cache control (including ajax?)
  • Combine dynamic requests
  • Build Single page application (using Ajax)
  • Avoid redirect
  • Fewer DNS lookup
Reduce download size - Send as little data as possible
Small data size saves bandwidth (tcp package numbers). It can be achieved using below ways:
  • Gzip resources
  • Minify JS and CSS (Code optimization, obfuscation, duplication removal)
  • Crush images
  • Add Cache control (caching in browser)
  • HTML5 local storage, local cache
For more info, refer to 14 Rules for Faster-Loading Web Sites