I've been maintaining a PHP/SQL e-commerce application and the customer has called about their ttfb jumping up to almost 3 seconds consistently.
What I've tried:
The test page loading quickly leads me to believe that it's some sort of query or logic that runs on every other page on the site (auth?), but none of the recent commits since the jump in ttfb have had any effect. How could this just randomly happen?
This is actually a performance optimisation problem that can be solved with profiling.
For profiling you can use xdebug or maybe other tools that are out there, however I personally didn't find a useful solution when facing a similar situation, so I just made a simple profiling module adapted to the app.
What you want to do is try to mimic on local or on staging servers the exact settings as in production, server settings, db entries, etc. And then just measure the execution time starting from first line in index.php, to key part of the app, for example db read/write class, http request class. And then write the data to some db so you can generate a profiling report.
So for each route and/or operation you would want to see how many db requests have been made, and how long they took to execute, how many API calls have been made (if this is the case) and so on. At the end the goal is to have a good idea what part of the execution flow is taking how long.