Retail eCommerce: How To Prep for Retail Season
The holiday season is just around the corner. For ecommerce businesses, that means a surge in online shopping activity and waves of customers hitting your sites.
Will you be ready?
While shopping days like Black Friday and Cyber Monday have historically been peak days for ecommerce activity, we know that shopping campaigns are releasing earlier and spurring consumer purchasing over the entire season.
All this makes it essential to ensure your application is well-prepared to handle increased traffic and provide a seamless customer 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.
Let’s unbox everything.
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 modifyWP_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
Applications hosted on the VIP Platform leverage multiple databases for optimum performance, with writes sent to an environment’s primary database and reads sent to database replicas.
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.
- When required, frontend database queries should always be related to a user-requested interaction—not automated (such as a “hit counter”). Processing AJAX or REST API requests through Javascript can also increase the full-page cache hit ratio.
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 object caching is an effective way to further improve application performance, via these methods:
Use Query Monitor
Assess object cache statistics with Query Monitor, including request time, volume of GET
s, and the total size of all objects stored in memory.
Group Memcached GET requests
Leverage wp_cache_get_multiple()
to group high volumes of Memcached GET
requests and minimize overhead when retrieving data from the object cache via high volumes of lookups/sets.
Upgrade WordPress
Move up to WordPress 6.2 (at minimum) or 6.3 to take advantage of multi-get functionality built into WordPress Core.
Mind the cache size
Keep individual cache objects under 1 MB in size (compressed), otherwise 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 sent back and forth over the network, making 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.
Combine cache requests
Try to cache many small requests in a larger request. For example, generating a page that collects data from the post object, thumbnail data from post meta, and 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.
Use helpers
For example, the Cache Nav Menus plugin 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.
For additional support
Questions or thoughts about any of these recommendations? Our Support Team is here to help.
30 days to better site performance
Speaking of taking site and application performance to the next level, have you heard about our VIP Performance Services?
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.