How do you keep your Umbraco site healthy over a period of time? Following routine maintenance plans, monitoring server resources, why has the Umbraco Backoffice just gotten so slow?
At Moriyama, we’re often called in to troubleshoot a slow performing Umbraco site, and there are many factors to consider, but one of the first things I always look at, for a site that’s been running for a couple of years, and with a reportedly slow Umbraco Backoffice is... how many content versions are there? How many rows in the cmsPropertyData table are there? Well, 14,006,050 is the record!
Every time you save a content item in Umbraco it creates a new version of that content in the database and this powers the ability for editors to ‘roll back’ a page to a previously published version, however ‘out of the box’ that version is kept forever! Therefore on a heavily edited site, these versions build up over time and can slow the Backoffice. Fortunately, there is a great package called ‘UnVersion’ that enables you to set a Versioning Policy for your site, eg. how many versions to keep for a particular type of page, or to set a length of time after which it’s no longer necessary to retain old versions.
Monitoring Content Versions
As this is a problem that can build up over time how best to keep on top of Content Versions? Make sure UnVersion is doing its job too? Well, this seems the perfect scenario for a custom Umbraco Healthcheck to run in the developer section of the Backoffice.
Healthchecks were introduced in Umbraco 7.5 and they were a successor to the old ‘go live checks’ package, but they are not restricted to just checking you have the correct configuration for a production environment, oh no, you can write your own custom checks to check, well, ‘anything’.
Paul Seal, my esteemed Moriyama colleague is curating a repository of useful Umbraco Community Healthchecks on GitHub, and I thought I’d contribute a check around Content Versions there...
... and rather excitingly it’s just been merged in! [Insert some kind of Giphy/Smiley Icon here]
If you install this community health checks package via NuGet or Umbraco, you’ll now get my new Content Versions Healthcheck in the Data Integrity section:
Running the Healthcheck will give you a simple analysis of the Content Versions that exist for your site. It will calculate the average number of versions your site has for a particular content item, the total number of versions and the most versioned item, it will also indicate whether the UnVersion package is installed.
What is ‘bad versions’?
It will depend on your server and site, but as a general rule of thumb If you find you have on average more than 5 versions stored for every content item, then that’s a bit of an indicator that you might need to look at some kind of versioning policy - similarly if you have items like a ‘Settings’ page that are constantly updated or any kind of code that imports content automatically into Umbraco, versions could become a problem. If you have more than a 1,000,000 versions in total, then that’s another threshold which usually prompts some un-versioning action.
But how will I remember to run my Content Version Healthcheck on a regular basis?
The great thing about building this as an Umbraco Healthcheck is these can now be run on a schedule,
Emailed or reported to Slack, so you can see over a period of time how the versions of content are building up in your Umbraco database, or just be reassured if UnVersion is installed, that it’s doing its job!
At Moriyama we have many sites that we support, maintain or provide consultancy for - and we’ve developed a suite of health checks and tests aimed at monitoring and keeping Umbraco site implementations healthy! Not just Umbraco Healthchecks either, the list of checks include Security, SEO, Site Speed and Performance checks.
Support customers receive a regular monthly email report of their site’s ongoing health containing ‘All the checks and tests (150 checks ranked by criticality!) - so any problems can be identified before they begin to impact the site - do you know when your SSL certificate expires?
If you are interested in finding out more about our automated healthchecks, tests, reports and good practice advice for keeping your Umbraco site in a fine state of health then please feel free to give us a call or drop us a line to speak about an Umbraco support contract: email@example.com