With ever increasing bandwidth and more powerful machines, I definitely used to believe that concerns over page speed were those faced by developers of ages before, but in reality that’s absolutely not the case. We spend more and more of our daily lives on the move with shaky connections on phones with dozens of simultaneous apps running concurrently. From personal experience, I believe users will blame applications over connection speeds, and quickly look elsewhere if they can’t receive a fast response.
Even as I write this post I cringe at the fact that I haven’t had the time yet to set this WordPress installation on a cloud instance behind a Varnish proxy (which someday will come), with content served from a CDN.
Application & server speed performance not only impact user experience, but also even search engine results. My go-to helpful guide is by using the following great tool.
Even on this blog page there are many things that I can do to improve this site performance.
So with this considered, here are my overall tips to improve your page speeds.
Use A Reverse HTTP Proxy
Personally, I think the fastest way (and easiest way) to immediately boost server performance is to stand a HTTP accelerator like Varnish or Nginx in front of Apache, Node, Rails, or Tomcat. A reverse HTTP proxy is just a fancy way of saying a server that stands in front of your content, and is designed especially to serve content especially fast.
Here is a beautiful and simple non-technical summary of the need for a proxy.
Varnish allows an API or website admin to provide effective cache control across the many kinds of resources being requested from a server. Based on Request headers, URIs, HTTP verbs, and hosts, you can set custom cache rules and protect your slower backends from being impacted by heavy traffic.
Use CDNs Like Cloudfront or Fastly
CDNs provide a set of clustered computers that are closer in proximity to devices, and are heavily optimized to deliver content quickly (sometimes using the same HTTP proxy tools I mentioned earlier).
When I started, I used to think that Amazon’s Simple Storage Solution was an example of the CDN, but after personal learning I’ve discovered that S3 is meant (and priced) for storage, wheras Cloudfront serves as a great way to serve static resources.
Memcached / Redis
Particularly along the line of SQL or MongoDB queries, I’ve found memcaching/redis responses have proved to be an easy way to dramatically reduce the strain on databases, and providing dramatic boosts to application logic time. Even just a 60-second cache on database queries can dramatically ease the load at the database level.
In terms of tools, I’ve been highly impressed by TinyPNG’s compression algorithm, since I usually can get 30-70% data savings without any perceptible difference to the quality of the images.
But sometimes TinyPNG doesn’t do enough compression I’ll use libraries like Node’s ImageMagick Module.
Besides gzipping at the HTTP proxy or server level, the static text minification is another way to boost page speed times.
Adjusting Server Config
Apache’s configuration files (as well as .htaccess files), for example, provide rich tools to manage cache rules at directory levels.