I'm running a Wordpress ecommerce website on a dedicated VPS with 4CPUs and 6gb RAM, so resources are not an issue . On top of this I have VestaCP installed, with a Nginx + Apache + Php-FPM server . Also using clouflare caching together with WP Rocket, which have worked together the best out of all tests so far .
After deploying the website in question I have been struggling with unbearably high TTFB times which account for around 2.5seconds average from multiple locations I have tested using KeyCDN .
So I made a new fresh wordpress install and realized that even though my TTFB still isn't the best, I could reach around 400 to 500ms average from multiple locations .
This allowed me to rule out the possibility of having a bottleneck at the server side so after a bit more debugging and installing Wordpress Query Monitor, I realized the total number of calls being done to the database only accounts for 0.09 seconds, so the database also does not seem to be an issue unless it's causing a huge delay even before the first query after TTFB ends runs .
Another thing I have done was to disable every plugin but that also didn't seem to help much, perhaps it took 300ms or so to the total loading time during the wait (TTFB) .
I feel a bit lost here and at this point am not sure what else I could do in order to debug this or what might be causing it .
Even though the db queries are running fast it still feels as it's the database that hangs for a while before the website starts loading .
Would really appreciate some insights on how to further debug this issue and how to rule out the database as a bottleneck .
Thanks