The holiday season is just around the corner, and for ecommerce businesses, that means a surge in online shopping activity. While shopping days like Black Friday and Cyber Monday have historically been peak days for ecommerce activity, we know that marketing campaigns are releasing earlier and spurring consumer purchasing over the entire season.
With an increase in customers visiting your sites, it’s essential to ensure that your application is well-prepared to handle the increased traffic and provide a seamless experience.
WordPress VIP has timely, expert advice to help your teams prepare for the rush. Below, you’ll find our Professional Services team’s top recommendations—from identifying performance bottlenecks to optimizing object caching—to set your sites up for holiday success.
Identify performance bottlenecks
The first step in preparing an application for the heightened demands of the peak ecommerce season is identifying performance bottlenecks. Many can be pinpointed with performance analysis tools such as New Relic and Query Monitor.
New Relic slow transaction traces offer a great starting point to identify which parts of a transaction are responsible for latency. Sorting by “Most Dissatisfying” is an effective way of surfacing the overall slowest pain points.
Query Monitor is useful for pinpointing exactly what’s happening on a given page, surfacing specific query-related details, and highlighting slow database queries that warrant further attention. Make sure to leverage Query Monitor when logged out for the most reliable results, as code pathways used when logged in can surface false positives or false negatives.
Leverage full-page caching
Full-page caching is the primary scaling mechanism for sites on the VIP Platform, protecting a site’s origin server from increased load (where a high cache hit rate exists) by retaining valuable backend resources to handle sudden changes in traffic.
While e-commerce sites require cookies on some pages, many do not, and setting cookies that mistakenly bust the cache on all pages is a common observation of e-commerce sites. To better position your application for scale:
- Avoid setting user cookies that bust the cache across all pages
- Limit the use of query parameters and non-GET requests that bypass the cache
- Increase the cache lifetime (max-age) for less frequently updated & requested URLs
Fix slow database queries
Slow database queries are often a quick path to poor application performance. Our new Slow Query Logs page in the VIP Dashboard can help identify issues bogging down application performance, setting you on a course to debug connections to your database. The following are effective and easily adopted methods to improve slow database queries:
- Offload non-performant queries with Enterprise Search (ES). Not all queries should be offloaded to Enterprise Search, but those that demonstrate evidence of performance issues are often better served via ES. For guidance, check our documentation.
- Add extra object caching to queries, particularly around custom queries.
- Reduce the use of JOINs, CALC_FOUND_ROWS, and limit results returned. Review our documentation to modify WP_Query requests for better performance.
- Build queries with indexes in mind, such as the difference between post_date vs. post_date_gmt. View information about the core WordPress database schema on WordPress.org and WPVIP’s custom post meta index in our documentation.
We have more information on optimizing database queries in our documentation.
Avoid database writes
Frontend requests that result in database writes can cause subsequent queries to read only from the primary database, which can negatively affect site performance and stability under load.
- Use Query Monitor to identify if queries are writing to the database.
- Avoid direct database queries in code wherever possible. Instead, use WordPress API functions for fetching and manipulating data.
- If direct database queries are required, follow these best practices.
Optimize object caching
Each WordPress environment is provisioned with Memcached, offering an opportunity to cache repetitive or expensive computations in memory to improve performance. Optimizing the use of object caching can be an effective way to further improve application performance, via methods such as those below:
- Assess object cache statistics with Query Monitor, including request time, volume of GETs, and the total size of all objects stored in memory
- Leverage wp_cache_get_multiple() to group high volumes of Memcached GET requests and minimise the overhead that occurs when retrieving data from the object cache via high volumes of lookups/sets.
- Upgrade to WordPress 6.2 or greater to take advantage of multi-get functionality built into WordPress core
- Keep individual cache objects under 1 MB in size (compressed), or they may fail to be stored–this is particularly important for the alloptions option, as mentioned in our documentation. Keeping object size down also reduces the amount of data being sent back and forth over the network and makes the request much faster. For example, instead of caching the entire result of a WP_Query request, which could mean many full WP_Post objects, consider caching the Post IDs and performing a much faster database query via IDs.
- Try to cache many small requests together in a larger request. For example, generating a page that will gather data from the post object, then collect thumbnail data from post meta, and then term/term meta data for additional context can quickly multiply the number of cache requests to build a page. Instead, cache the generated HTML output to perform this process in one single cache request rather than dozens or hundreds.
- Make use of helpers such as the Cache Nav Menus plugin, which provides a drop-in replacement to WordPress core’s wp_nav_menu() that adds additional caching to reduce database and Memcached usage when generating complicated navigation menus.
Do you have questions about any of these recommendations? Our Support Team would be happy to help.
30 days to better site performance
If you’re interested in taking site and application performance to the next level, we encourage you to explore our VIP Performance Service.
Led by WordPress Core experts, our team can dive deep into your code, determine the root cause of performance issues, highlight opportunities to improve SEO performance, and deliver tailored recommendations that prepare your site for exponential growth.
We then partner with your engineering team and/or agency to apply those recommendations, and perform a secondary review to assess the impact of that work.
If you’d like to learn more, please reach out to your Relationship Manager or VIP Support.