On 2 March, the Latvian WordPress group held the Profiling WordPress Sites meetup. The presentation covered the profiling of heavy WordPress sites. Our speaker (@kagg-design) analyzed the applicability of the Query Monitor plugin and profilers, including Blackfire. He gave real-world examples of site optimization, including optimization of the number of queries to the database as well as optimization of CPU time usage. The meetup materials are available for download from the links below.
The first case study was based on a site where 3,700 database requests occurred when using WooCommerce, WOOF, and WOOF by Category plugins. The speaker gave an explanation of how he optimized the WOOF plugin using transients.
The second example showed that a developer, due to inattention, left a line of the code that made 3,200 queries to the database. In other words, the result of executing this line was not used anywhere else. It is concluded that the developer caused the problem by using obsolete development tools like Notepad++. Use modern IDEs like PhpStorm or VSCode and you will avoid many severe errors!
Lastly, the third example showed optimisation purely on CPU time. This analysis is only available using special profiling tools like Blackfire. The optimization reduced CPU usage by a factor of 330 (from 2 min 40 sec to 0.44 sec).
Finally, conclusions were made on the applicability of the Query Monitor plug-in and the Blackfire profiler and recommendations for their use are given.
Profiling WordPress Sites as the first meetup in the series
That is to say, the Profiling WordPress Sites meetup was technical in nature and aimed at advanced developers. Nevertheless, it generated considerable interest, with 77 participants registered. We plan to hold a series of meetups of this kind in the Latvian WordPress meetup group. A preliminary plan looks like this so far.
- Debugging in WordPress (debug.log, xDebug)
- Testing code with PHPUnit
- Object caching practices
- Best-practices with 3rd-party APIs, including security
- Background processes, usage and debugging
- Profiling and subsequent optimization in examples
- Mutation testing
- Gutenberg by a developer’s eyes – the creation of blocks, debugging
- Backward compatibility in WordPress
- WPCS and PhpStorm settings
To clarify, this series of meetups will be held in Russian. In the comments to this post, we invite you to discuss the content and sequence of the meetups. Any comments and suggestions are welcome.
To sum up, you can download the presentation here, and the recording of the mithap (in Russian) is available below.