Troubleshooting Kentico performance


Some clients tend to spent extra money on buying better hardware for their environments, thinking this will help speed up their website. However, the reality in most cases is very different. We should always ask ourselves, whether we have done everything we can to make sure the website is really optimized.

This article discusses various steps which can be used during troubleshooting Kentico performance issues, such as slow page loading times, and describes several general tips and tricks which may help improve the website performance.

Is it a problem on one specific page, or an issue with the whole site?

Check if the performance issue is consistent across the whole website or for particular pages only. 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.

If it takes long to load this test page, the problem will probably be site-related. But if the performance is bad only on some particular pages, 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 it loads data efficiently.

Event log and browser errors

Error messages are always your best friends helping you to identify potential problems with your environment.

  • Check if there are any errors logged in the Kentico 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 you’re your Kentico 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 developer tools in your browser.
    • 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.

  • Check the System information application to see if the memory usage, CPU usage and other metrics are in normal value ranges. You can also work with the Use the Kentico debugging tools to identify:
    • The worker threads that take too long to execute.
    • Which SQL queries are pulling too much data and taking too long to finish (most of the performance issues are caused by too big or too many SQL queries).
    • If you are using caching, use the cache debug to check if the data is correctly cached.
  • Use the Health monitor tool (EMS license only) to get various statistics about the requests and the overall health of the Kentico instance. You can also work with other Windows Performance counters to check the health of the server.

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 Kentico 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).
  • 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 – instead it will be cached on the client side.
  • 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.
  • 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.
  • 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.
  • Make sure your web parts load data efficiently.
  • 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.
  • Disable the output filter and write better code.
  • Think about the best storage for your files. If you don’t need to store big files or large amount of attachments, database may be the best choice. For big amount 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).

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. 

That is why you should find some time 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 HW for your server) and scaling-out (horizontally: adding more servers) techniques, or simply move 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 when the number of visitors or hits might rapidly increase, we recommend to consider running your website in a web farm environment.

Performance and Health Audit

If you encounter any performance or stability issues, Kentico Senior Solution Architects with extensive Kentico knowledge can investigate the root of the issues and provide you with best practice solutions to resolve them and recommendations to avoid them in the future through the Performance and Health Audit package.

Additional resources

Share this article on   LinkedIn

Zoltán Jalsovszky

Senior Support Engineer at Kentico Software