Loading...

Helloooo Sitecore! Are you alive and how are you doing?

Sitecore introduced built-in health check HTTP endpoints in version 9.3 which can be used to check health of your Sitecore instance. They work well for out-of-box health check experience which works great for most sites however, depending on the size of your web application and requirements you will probably have to write custom health checks. More on that below.

Sitecore 9.3 and higher can monitor the health of its roles through following HTTP endpoints:

  • Liveness health check
    A liveness health check shows whether a role is online and can be reached. This simply returns 200 status code and “Healthy” message if role is alive and responding. It does not check any dependencies or give any additional information about health. Main benefit is that it is very fast to respond and has negligible performance impact on the role.
  • Readiness health check
    A readiness health check shows you whether the role is online and has access to all critical dependencies. Important thing to note with this option is that it is not as fast as liveness health check but should not be having a noticeable performance impact. SQL and SOLR checks are included which is typically enough.

Health check code is located in Sitecore.Diagnostics.HealthCheckController which is part of Sitecore.Kernel.dll

Here is the code for the ones who are interested to see it. You can dig in deeper on your own :)

As mentioned in the first paragraph if you need any special or additional health check you will have to write custom health checks on your own. Then you will have to make sure those health checks are properly deployed in all relevant roles. You can read more about health checks here and here.

What about if you need a health check for earlier versions of Sitecore?

For Sitecore versions before 9.3 and pretty much all other Sitecore versions, including 9.3 and higher you can:

  • Use keepalive.aspx
    Hitting https://<SITE>/sitecore/service/keepalive.aspx page provides the same liveness health check as mentioned above. This simply returns 200 status code and “Keep Alive Page” message if role is alive and responding. It does not check any dependencies or give any additional information about health. Main benefit is that it is very fast to respond and has negligible performance impact on the role. Also, it is present in ContentDelivery, ContentManagement, Processing and Reporting roles.
  • Use custom_write_your_own_health_check.aspx
    Write your own custom ASPX page and add any health checks you require there. While you can simply use keepalive.aspx for CD, CM, Processing and Reporting roles you will need a custom health check ASPX page for all other Sitecore roles. Main benefit of an ASPX page is that you can simply drop it in any Sitecore role without having to restart the web app or change any configuration settings. How you implement custom ASPX page is up to you, just keep in mind to make sure it is super light. For example, with custom ASPX page you can:
    • check SQL availability
    • check SOLR availability
    • check REDIS availability
    • making sure content is preloaded
    • etc.

I hope this article helped you understand some of the ways you can monitor Sitecore role health. There are few other ways to do this and I may talk about it in one of the future articles.

Thank you for reading this article :)

Disclaimer
This is a personal blog. The opinions expressed here represent my own and not those of people, institutions or organizations that the owner may or may not be associated with in professional or personal capacity, unless explicitly stated.. In addition, my thoughts and opinions change from time to time I consider this a necessary consequence of having an open mind. This blog disclaimer is subject to change at anytime without notifications.