It takes time to build websites that are both high performing and pleasing to the eye. The performance of a site, both functional and visual, is ultimately determined by its configuration and the level of testing it is subjected to.
To support Common Web Platform (CWP) developers in their projects, we’ve put together a performance guide that we consider to be an essential read. Both the performance guide and SilverStripe’s debug toolbar were delivered through the co-funded development pool. We won’t go into the details of the performance guide in this post but we will touch on what areas the guide covers.
Testing your code is a crucial step to ensure everything works as expected. Establishing the current state of your site’s performance will give you an idea of where and how performance gains can be made. Pages that experience high volumes of traffic should be prioritised with testing over low volume pages. The guide covers a number of tools to consider when testing, including the debug toolbar.
As a CWP developer, it is crucial to understand both SilverStripe and CWP infrastructure capabilities for caching. The performance guide goes into detail following general best practices around caching, when caching will make a difference and when excessive computational work is slowing your website down.
Juggling requests to improve user experiences and general website performance is not easy. Prioritising jobs and assessing the impact of your work on users is all part of the challenge. The Queued Jobs Module and Crontask Module help to address these issues workflow and prioritisation.
Front-end Best Practices
Working with APIs
If integrated correctly, third-party APIs can considerably extend the functionality of your website. The performance guide covers how to best cache response data, when to pre-fetch data to reduce wait times and how to handle API failures. Tools like the Circuit Breaker Pattern help you to catch API failures before they happen.
Dealing with 404s
As developers, we want to avoid users hitting 404s whenever possible. Although sometimes out of our control, there are a few best practices that can be followed to reduce 404 bloat. If migrating a legacy site to CWP, you should consider implementing the .htaccess redirect so any legacy traffic is sent to the new site. If 404s are a concern, the Reports module which is included in the CWP basic recipe, helps to identify links that are pointing to missing resources.
Build stable, high performing websites
While the SilverStripe Open Source project has documented many of the performance optimisation approaches, this performance guide has been specifically designed to improve performance on Common Web Platform. If you have any feedback on how we can make developing on CWP easier for developers, please get in touch.