Pet360.com: Teaching an Old Dog New Tricks
By working with Pet360 on performance issues we were able to integrate ourselves internally to create a truly binding relationship. We not only handled and increased performance, but also became an ongoing part of product management, ultimately interfacing with every part of the business for over two years, frequently working with the customer on-site.
What we did
Taking a Bite out of the Market
Pet360.com encountered issues with the full-page cache being constantly invalidated, causing longer than acceptable load times. In eCommerce, long load times have been directly correlated to lower conversion rates, so this was on the short list of items to resolve.
The second challenge was that, in particular cases, information was slow to load from the backend. The infrastructure looked good, but there were issues inherent to the platform that needed to be resolved. It takes a team with experience in these types of issues to fix them.
Challenge 1 – Frontend Performance
We knew right away that there were a number of ways to resolve the issue. To get started, Pet360 quickly integrated us into the internal team. The Pet360 tech team was well organized into multiple subgroups that never operated independently. Their processes were already in place, which allowed us to easily get in and roll up our sleeves.
We discovered a number of issues, such as a tag vendor hole-punching the cache, and dynamic values being rendered directly on the page. The problem wasn’t that cache was broken, it was that everything was cacheable. What this means: Imagine logging into a website and sometimes a welcome message comes up (Welcome, John!). Something as small as this in the header this can trigger the need for every page to be re-cached, so as a new user you’re effectively browsing the site with the performance of it not being cached, and as the number of simultaneous users grows so does the cache (and its ineffectiveness).
The quick resolve was to implement to straightforward, but vital functions:
- AJAX most dynamic blocks
- Work with the tag vendor to make their data object return from an AJAX call
This difference of dynamic data isn’t problematic in this case. The reason is there are not a lot of dynamic blocks in the system due to an external personalization system being used to inject banners and other marketing imagery, and moving the tag vendor’s data object to an AJAX call was faster than it being part of the full page cache.
These changes reduced the need for full page caching in Magento, and the Ops team was able to utilize external caching with CloudFlare. Load times were significantly reduced, from a TTFB of over 5 seconds to under a half-second.
Challenge 2 – Backend Performance
Next on our plate was to improve backend performance. Three important cases were:
- Admin customer lookup
Magento as an eCommerce platform is built with most stores in mind. This means that it needs to be well understood to have it work in a performant manner at scale for the stores outside of most.
Pet360 has millions of customers, and Magento has a very normalized database. Any chance available to reduce the number of JOINs and full table scans used in the database, the happier your system will be.
The full-text search combined with JOINs would cause queries to take over 20 seconds and pin the CPU at 100% for 15-30 minutes due to full table scans. Knowing this, we know that Magento has flat table interfaces to be used for admin grids. However, this feature was never implemented for customers. We implemented a table that would act as an aggregate of the normalized customer table. This action reduced the search queries down to 0.017 seconds and directly increased the number of customer service calls that could be processed.
Pet360 had an external search vendor and it relied on search metrics that are part of the core Magento functionality. With heavy search volume, this quickly became a problem. We profiled the database queries being called and we were able to reduce one query in checkout from 0.45s to 0.0014s, and another from 2.0s to 0.0007s. This drastically improved checkout times and customer happiness.
The last piece to the slow backend queries was checkout. One particular query still took around 7 seconds to run, which is a half-second for the customer (a big chunk of time in checkout).
Using the new customer grid table that we implemented, we added one more column to track the customer nickname, reducing the time to an average of less than 0.02 seconds.
These are three examples of core Magento functionality that are easily improved using techniques already implemented in other parts of the system.
By initially working with Pet360 on these performance issues we were able to integrate ourselves internally to create a truly binding relationship. We not only handled and increased
Pet360 was acquired by PetSmart in September 2014