Huge <15sec TTFB - drives me crazy

Hi guys,

since yesterday morning i suddenly see a huge delay in pages loading.
I didn’t change anything to configuration of Apache.
Using VPS and LAMP.

Struggling to identify all day and night long yesterday what is happening…

[url=https://www.webpagetest.org/result/171009_18_be13a9f5d173df1b0b59d32e981aa8e1/1/details/]https://www.webpagetest.org/result/171009_18_be13a9f5d173df1b0b59d32e981aa8e1/1/details/[/url]

Do you have an idea or please give a hint?

mysqltunner gave:

Run OPTIMIZE TABLE to defragment tables for better performance
MySQL started within last 24 hours - recommendations may be inaccurate
Enable the slow query log to troubleshoot bad queries
When making adjustments, make tmp_table_size/max_heap_table_size equal
Reduce your SELECT DISTINCT queries without LIMIT clauses
Variables to adjust:
query_cache_size (> 16M)
tmp_table_size (> 16M)
max_heap_table_size (> 16M)

it was a f@cken plugin

Hi,

A couple of thoughts.

  1. Cache the HTML document - it is super cachable by the looks of the website - you should be able to serve from cache (e.g. Varnish on a CDN) in circa 200ms.

  2. Put APM on your web server (like New Relic) to id the long running code / query on your site.

Ouch - can you let us know what plugin it was that caused the issues? Perhaps it was misconfigured?

Glad it’s fixed though.

The problem you’re seeing relates to your LAMP Stack + likely your entire runtime environment.

Asset #1 (HTML component) serve time on your site relates to both your hardware (VPS) + software (LAMP) + WordPress code (core + theme + plugins).

WebPageTest - Running web page performance and optimization tests... shows an example of a site I host. Notice the total time required to server Asset #1, after DNS, is 153ms.

I target <300ms for serving Asset #1 for my clients.

Here’s how I do this.

I run Ubuntu on bare metal servers (no VPS + no VMs).

Then LXD at machine level + sites in LXD containers.

This way I can tune each site’s LAMP Stack for each site’s specific work load.

The site in the example above is a WordPress membership site under heavy usage.

Since you’re running in a VPS slice, this likely means your VPS is running inside some sort of slow VM.

This type of setup is highly effected by other sites running in other VMs on the same hardware.

All this said, your likely first step is to change hosting, to a company which understands how to run high speed WordPress site hosting.

That’s your first step.

Once your site’s running in well tuned hosting, then you’d have someone go through your site + fix anything slowing your site down. This list can be long + complex.

If you’re a DIYer, a good starting point for you is to enable SAVEQUERIES + WP_DEBUG + check your WordPress debug log file for any problems + install the Query Monitor plugin + debug/fix all reported issues.

I’d suggest you only go through the Query Monitor debug/fix cycle, after you’ve changed to fast hosting, because you may find all problems vanish when your site runs on a well tuned LAMP Stack.