When examining the website of one of our clients, AMS, we encountered a challenge: the site, with its vast content spanning over 2000 pages in two languages, faced downtimes, especially during high traffic periods triggered by our email campaigns. The issue? A significant increase in PHP activity overwhelmed the system whenever a large audience engaged with the site simultaneously. Determined to address this, we have delved deeply into the matter to develop a robust solution to enhance the site's reliability and performance.
The first step in our quest was to replicate the AMS website in a test environment, allowing us to conduct stress tests without risking further downtime. Using Loadforge, a tool for simulating user visits, we initially tested the site's capacity with 500 users, leading to downtime. Even more surprising was the site's inability to handle just 50 users, signaling a profound need for optimization.
With the help of New Relic, a monitoring feature provided by our hosting partner DeltaBlue, we identified that web transactions were excessively high, significantly impacting the site's performance. The analysis revealed that PHP transactions and database queries were the primary bottlenecks, with transaction times peaking alarmingly during heavy database interactions.
Our approach to resolving these issues involved several strategic enhancements aimed at reducing server load and improving site performance.
Caching acts as a mechanism to store and quickly retrieve frequently accessed data, thereby speeding up response times. Despite having the "Blitz Cache" feature available, it was initially inactive.
"Blitz Caching is a cutting-edge technology designed to significantly improve website performance by intelligently caching content. It identifies and stores frequently accessed data, allowing for faster retrieval and reduced server load times."
Activating it and making necessary adjustments, such as disabling conflicting caching features and automatic page refreshes, significantly improved site efficiency. This allowed the AMS website to accommodate a larger volume of requests seamlessly.
Craft CMS is historically structured with different sections. There are entries for webpages, categories for content categorization, and globals that store website settings and variables. The manufacturers of Craft CMS are currently rebuilding this setup from scratch. With Craft 5, everything will be consolidated into a section called 'content'. So to address the globals issue, we had to 'entrify' all the globals, categories, and tags, as suggested by Blitz.
The structure of Craft CMS, which underpins the site's content management, was then streamlined. This optimization meant that updates to text or images could be made without the need to refresh the entire site cache, conserving server resources and enhancing the content management process.
By moving the site's navigation setup to a dedicated plugin, we minimized complex queries and improved integration with the caching solution. This change further reduced the server load, making the website more responsive to user interactions.
The results of our efforts were unequivocally positive. A subsequent stress test with 1000 users showed no downtime, marking a significant milestone in the site's performance capabilities. Server efficiency improved dramatically, with the ability to handle an average of 32 requests per second without any hiccups (see image below).
Post-deployment analysis using New Relic showcased a 50% decrease in web transactions, with transaction peaks during high traffic periods remaining consistently below pre-optimization levels. Moreover, the improvement in the Apdex score indicated a significantly enhanced ability of the server to manage the website, leading to a superior end-user experience.
The journey to improve the AMS website was one of meticulous analysis, strategic planning, and effective implementation. By addressing the root causes of performance bottlenecks and deploying targeted solutions, we not only overcame the challenge of downtime but also set a new standard for site reliability and user satisfaction. The AMS website is now used to its full potential and ready to serve its audience with much more efficiency.
Thanks to the efforts of team Lunar the end-user experience has been greatly enhanced compared to the previous state.