ocReaper / wp-server-timing

Add Server-Timing header information from within your WordPress sites.
MIT License
31 stars 7 forks source link

More details about server timing sections #22

Open aminjabari opened 2 years ago

aminjabari commented 2 years ago

Hi I just used your plugin to diagnose server response time issue.

In my case, template processing is the most problematic area (2.9 s of total 4s). Could you elaborate more about this section? How can I reduce the time spend in this section? Just replace the theme? is there any other solutions?

Thank you.

ocReaper commented 2 years ago

Hi @aminjabari! Usually it means that you did not separated the business logic from the presentation and in your (for example front-page.php) template file. So you do all the db related logic and filtering the data there instead of functions.php.

What you can do is check the db queries: maybe they can be simplified with a plain sql query. Check for sorting and filtering logic in the php: most of the time, they can be moved to the db query. Check for file related activities: some themes load SVG images via file_get_contents which results in increased server response time. Also you can use WP Rocket or other caching plugin wich will basically zero out this section, because they will serve pre-generated static HTML files instead of processing the template in real time.