Many performance issues can be identified with available performance analysis tools. Once these performance issues are identified, developers should work towards correcting them.
HTTP request logs
HTTP request Log Shipping provides request logs for a site and can be analyzed with a variety of tools such as GoAccess. Logs include the page generation time, response code, and cache status for requests.
By analyzing a site’s traffic patterns, the slowest requests can be identified and attention can be focused on the code that needs to be optimized.
Review request logs for:
- The presence of significantly slower requests
- Patterns of bot activity or bot requests (usually through the logged User Agents) for pages that do not need to be indexed (e.g. bots should be requesting sitemaps and individual posts, but not crawling through every page of an archive or tag)
- The presence of cache busting URL parameters
- Requests for files in the WordPress
/uploadsdirectory, especially large images without resize parameters
404or other status codes in the
Local (or non-production) environment
Though a local environment is not an absolute replica of a VIP environment, it can provide insights and understanding of the code executed during a request.
- The MySQL
EXPLAINcommand will be more accurate and can reveal inefficient queries if a recent database backup of a production environment has been imported to a VIP Local Development Environment.
- End-to-end tests can be run if a VIP Local Development Environment is running with a clone of the application’s GitHub repository.
- Xdebug can be used to profile a request and identify operations that require greater amounts of time. In the VIP Local Development Environment, Xdebug can be enabled with the setup wizard or by passing
vip dev-env createor
vip dev-env updatecommands.
New Relic is an Application Performance Monitoring tool that shows current and historical average page generation times. New Relic can also capture traces of slow requests. Traces can be reviewed to determine where the most time is being spent.
If a particular URL has an intermittently slow issue due to object caches expiring, a trace should be captured. These issues can be difficult to catch in Query Monitor.
Reported PHP errors, warnings, and notices can point out issues in code. The fewer code issues that exist on a regular basis, the easier it will be to identify, review, and resolve new issues. Ideally, an application routinely generates no errors, and few to no warnings.
New Relic also has a summary of database queries and remote requests, making it possible to identify potential issues specific to a table or API endpoint.
New Relic also has a summary of database queries, object cache usage, and remote requests, making it possible to identify potential issues specific to a table, function, or API endpoint.
Performing a local PHP_CodeSniffer (PHPCS) scan of the code in an application’s wpcomvip GitHub repository will flag many potential performance and security issues.
Query Monitor can be helpful to identify PHP errors, slow queries, remote requests, and other anomalies on specific pages. Query Monitor also reports the page generation time.
During development, Query Monitor’s Profiling and Logging functionality can help keep track of feature performance before deploying code to production.
Runtime Logs reports PHP errors including fatals, warnings, and notices for WordPress applications, and output sent to
stderr for Node.js applications.
Last updated: January 10, 2024