About the Client
Nutrabay is a leading distributor and seller for health & fitness supplements in India. Listed as a seller on 15+ popular online stores, Nutrabay has a considerable distribution network that spans hundreds of physical locations.
Nutrabay’s aim is to help anyone find health products that suit their lifestyle. A big part of achieving this goal is having a rock-solid online store that helps users search and buy products from among the myriad of brands available in the market.
The key challenge that Nutrabay was trying to fix was getting their servers to scale past handling more than 250 concurrent visitors. Further, code and setup inefficiencies were negatively affecting the experience that visitors had, reducing conversions and increasing bounce rates. Other issues included:
- Massive delays with any action that involved sending emails
- Excessive use of CPU resources even during non-peak hours
Setting up Caching
rtCamp started the project by conducting a review of Nutrabay’s servers and the code running on them. Baseline performance readings were collected at this point.
rtCamp set up a new server using EasyEngine, an open-source server management tool developed in-house. Since EasyEngine can apply page and object caching, PHP7, the latest version of MySQL and a host of other server tweaks out of the box, this route was much quicker than setting each of these up on Nutrabay’s existing servers.
By implementing object and page caching backed by Redis on the server level, rtCamp eliminated the need of a separate caching plugin. These caches worked to reduce the number of requests to the database, thereby reducing the load on the web server. Cache invalidation was added and tested to eliminate user session conflicts.
During the process of migrating the site’s database from the old setup to the new one, rtCamp ensured that all database tables were utf8mb4 character encoded. This was to mitigate some issues that Nutrabay had been having due to mismatched encoding standards across tables.
Codebase Optimizations
rtCamp then turned its attention to page response times. This metric is particularly important for eCommerce sites as several important pages in the customer acquisition journey cannot be cached and thus have to be quickly served when a customer lands on them.
To analyze the effect of the plugin and theme codebase, rtCamp configured New Relic APM on Nutrabay’s new server. A few rounds of load testing were then conducted using Loader.io. These tests, in conjunction with New Relic’s excellent reporting, helped rtCamp understand the bottlenecks in the server config. rtCamp cleaned up the wp-options, wp-cron, and some autoloaded data in wp_options tables.
rtCamp observed that some plugins were frequently flushing the entire object cache of the site using wp_flush_cache. This excessive cache flushing was causing sudden CPU spikes. To fix this, rtCamp removed the code that was responsible for this behaviour. rtCamp also removed a few other plugins and replicated their functionality through lightweight custom code.
Taken together, all of these measures ensured that Nutrabay’s servers were operating at maximum efficiency.
Streamlining the Checkout Process
The transition time between the checkout page and “thank you” page on Nutrabay’s old setup was unacceptably high. On investigation, rtCamp observed that the Sparkpost plugin was being used to deliver the various transactional emails to the customer and website administrator.
rtCamp bypassed this by removing the SparkPost plugin from WordPress and configuring the service directly at server level using Postfix. This drastically reduced the transition time from 4-5 seconds to less than 1 second.
rtCamp’s optimizations worked to streamline Nutrabay’s website. Server response time reduced by about 87%, page load times improved by more than a second on average, and Nutrabay’s servers are now capable of handling 1200+ concurrent users. The seemingly random CPU spikes no longer occur, and Nutrabay’s checkout process is quicker than ever.
rtCamp continues to work with Nutrabay for ongoing WooCommerce development and server maintenance.