Is there more performance I can eke out of my server?

November 14, 2016 148 views
Apache LAMP Stack Ubuntu

This is probably crazy, but I'm trying to reduce my page load times as much as possible. I'm not sure if I'm being held back by the server, or if there is more performance to be had just by tuning. I've done a certain amount already and my site already scores 100 on Google PageSpeed, but my TTFB is still pretty slow for a completely static site.
Basically I'm just serving a static HTML file and a couple of images at this stage, but TTFB is something like 550ms. I'm running the base tier DO Droplet (1 cpu/512mb RAM).
My question is whether I can expect better from the server with more tuning work or whether I really need to upgrade to a pricier environment to improve page load / server response times.

3 Answers

Having now tested the site through Pingdom on a closer server, I don't think there is any further performance to be gained out of tuning.
Where GTMetrix in Canada takes ~950ms to load my 32k site, Pingdom in Melbourne loads in ~300ms, with a TTFB less than 100ms.
A lightweight Wordpress installation on a subdomain on the same site loads in less than a second, which I think is plenty fast enough.
The only next step to improve performance is probably a CDN

No, not at all.

As you optimized PageSpeed Insight to 100/100, you done what most would say:

  • Enable (gzip) compression.
  • Enable and configure caching.
  • Optimize images.
  • Minify HTML.
  • Minify CSS.
  • Minify JS.

I myself done PageInsight optimization this weekend, and they're definitely very strict to improve your page load time.

We need to know we can't really make everything perfectly. For some type of performance you will 'sacrifice' other one.

First of all, I guess you know what it is but for future readers. TTFB is 'Time-To First Byte'. So basically how much time you need from making HTTP request to receiving first byte (to start to receive content).

What is the first thing that can make this effect? Well, Compression. The reason is it takes time to compress content before transferring it. If you really want to test things, disable it - then do the PageSpeed Insight. You'll get lower score definitely. Measure TTFB. It could be that it's much lower.
I guess that compression could be biggest bottleneck for TTFB. Other things does nothing to slow it down.

The second part we need to take in consideration is your Internet. Especially if you're not close to the server.

@newbie gave idea of nginx and CloudFlare.
For nginx - I'll not agree. It's basically the same thing that you use Apache or Nginx (especially for static content). You'll not get any performance boost from one or other.
Yet for CloudFlare - I'll agree. It offers you CDN possibilty, that can improve both page load and probably TTFB. I recommend you to set up it and try it. They have a free plan that will finish job for you.
In very basic lines - why does it improves it. Let's say that CDN caches static content on their servers and use that to answer your request. It's much faster because serves content from many servers around the world. You can get content from server much closer than your one.

Will upgrading server help... You have to test it. For example, maybe one more CPU can reduce compression time if that's the problem. Maybe no, I'm not sure and can't say yes or no.

If you got any more questions - feel free to ask. :)

  • Thanks for your thoughts, I tried turning off gzip, but the difference in TTFB (and delivery of the whole page) was minimal, probably because overall gzip is saving me ~5k.
    I think in terms of content, the site is well beyond needing more optimisation, I was just wondering whether I could get better performance out of the server itself, and whether the ~500ms TTFB was typical of this tier of hosting.

switch to nginx and use fastCGI.

are you using cloudflare by the way? Cloudflare increase the TTFB

  • I know nginx/fastCGI is faster for PHP processing, but I didn't realise it was faster for static files.
    No, I'm not using Cloudflare.

    • I have now tried changing my web server over to nginx / FastCGI and would like to say it has made absolutely no difference to the performance of my site. TTFB is pretty much exactly the same as Apache.

Have another answer? Share your knowledge.