Troubleshooting Kentico Xperience performance
Some clients tend to spend extra money on buying better hardware for their environments thinking that this will help speed up their website. However, in most cases, the reality is that achieving better performance is often more complex than simply upgrading hardware. We should always ask ourselves whether we have done everything we can to make sure the website is optimized.
This article discusses various steps which can be used during troubleshooting Xperience performance issues, such as slow page loading times, and describes several general tips and tricks which may help improve the website performance.
Note: Make sure to check the development model you are using for your Xperience projects when attempting to implement these suggestions. Some of the links in this article only apply to specific models (Portal Engine, MVC5, .NET Core) and are noted as such next to the link when this applies.
Is it a problem on one specific page, or an issue with the whole site?
First, you should check to see if the performance issue is consistent across the whole website or only on particular pages. A good way to test this is to create a new, blank test page with no web parts or widgets on it. It is also a good idea to disable the content inheritance to rule out any problems with the Master page on Portal Engine or _layout files for MVC sites.
If it takes a long time to load this test page, the problem is likely site-related. If you are experiencing bad performance only on some particular pages, however, you should check the web parts on these pages one by one to find which one takes a long time to load, and make sure that they are Loading data efficiently (Portal Engine). For MVC5 and .NET Core, load only the data required by your views or related code: Loading data efficiently in MVC.
Event log and browser errors
Error messages are always your best friends for identifying potential problems with your environment.
- Check if there are any errors logged in the Xperience Event log application.
- Any Page not found (404) errors could indicate an issue.
- Any other errors or exceptions mean that there is something going wrong in your Xperience instance and needs to be addressed.
- Check the Windows event logs for any IIS related errors.
- IIS application pool crashes (w3wp.exe) will have a significant effect on the performance.
- Access denied or timeout errors can also slow down your site.
- Use the developer tools (Chrome and Firefox) in your browser.
- Look for any JavaScript errors logged on the Console tab.
- Using the Network tab, try to identify which resource takes too long to load.
Use debugging to identify any suspicious behavior
In some cases, error messages will not help you find the root cause of the poor website performance, or there will be no errors logged at all. In such cases, it may be useful to enable debugging and analyze what is happening in the background.
Review any custom code you are using
Sometimes the problem is caused by custom code or classes which are extending the out-of-the-box Xperience functionality. By disabling or removing the customizations temporarily, you can determine if they are causing any performance issues.
It’s a good idea to check:
- Any global event handlers you added to the App_Code folder (Old_App_Code in case of Web applications).
- Any custom modules you created (which may also have their own classes in the App_Code/CMSModules folder).
- Portal Engine (or X13 Admin Interface) - Customized web parts which you are using on your pages.
- Any JavaScript or CSS code your pages are utilizing.
- Optimization of your custom code.
Eliminate communication between client and server
- Move JavaScript and CSS code into external files so that the same code is not transferred over and over again – this way, it will be cached on the client side instead.
- Move resources to a different domain. Browsers can download only 5 files concurrently, so moving the files to a different server or domain, for example a CDN, will allow the browser to download more resources at the same time, decreasing the overall page load time.
- Portal Engine - Combine resources.
- Enable client-side cache for all possible resources.
- Try to avoid using cookies – they are sent from the client to the server with each request.
- Reorganize the resources on the page to improve performance.
- Disable ViewState.
- Portal Engine - Use code minification & compression.
- Eliminate HTTP redirects.
Server side caching
Caching is the most powerful performance tool but it needs to be used wisely. It should be enabled as the last step when it comes to website optimization.
Every project is different and therefore there is no general rule on how to set up your caching plan. The golden rule says that caching data, even if for a short period of time, is better than no caching at all. However, enabling caching could just suppress the real symptoms, which is not the proper way to start addressing performance issues.
Once you have verified all the above steps, you can continue with configuring caching.
Various server performance tweaks
- Eliminate intensive and resource consuming operations.
- Disable scheduled tasks which are not used or run them in an external service (EMS license only).
- Increase the execution interval of scheduled tasks.
- Portal Engine - Make sure your web parts load data efficiently.
- MVC5 – Make sure you are Loading data efficiently in MVC.
- Portal Engine - If you are not displaying any sensitive data, or only data that should be publicly available with the web part, you should disable the Check permissions option in the web part settings. As with any other check operation, you are adding another step in the retrieval process. This results in additional resources being used as well as a possible delay in the response time.
- Portal Engine - Disable the output filter.
- Think about the best storage for your files. If you don’t need to store big files or large amount of attachments, the database may be the best choice. For large amounts of data, it is recommended to store the files in the file system.
- Consider using Media libraries instead of storing the files directly in the content tree.
- Disable features/functionality which you are not using (you can also remove them from the installation).
- Review your environment setup (software, hardware) for any potential bottlenecks.
Kentico Advantage
Most of the performance issues arise from incorrect website design in the first place. As the website grows over time, you could find yourself redesigning the website from scratch because the scalability of the website cannot be easily improved.
Because of this, it is recommended to read through our Kentico Advantage guide, which discusses various topics related to correct website design and goes through the entire project lifecycle.
Server hardware
If the website is optimized and still not performing according to your expectations, then it’s time to think about scaling-up (vertically: using better hardware in your server) and scaling-out (horizontally: adding more servers), or simply moving the website to cloud hosting (Windows Azure, Amazon, etc.).
If you would like to host your website in your own environment and serve more requests in the future, we recommend running your website in a web farm environment.
Performance and Health Audit
If you encounter any performance or stability issues, our experienced Kentico Solution Architects can investigate the root causes, provide you with best practice solutions, and furnish recommendations on how to avoid them in the future through the Performance and Health Audit package.
Additional resources