9 YEARS AGO

Clean unused memory automatically (or not?)

About a month ago I showed you how you can easily reduce the number of project files by uninstalling modules using the Kentico Installation Manager. The goal was to reduce the memory usage of the application pools and to speed up the build of your Kentico projects. In this post I will continue the road to a better performing website and show you how you can leverage the scheduled tasks in Kentico to keep your memory profile as low as possible.

When you install a clean installation of Kentico it will automatically ship with a couple of scheduled tasks that run on the background of the application. These tasks execute typical actions like sending e-mails, deleting temporary files and optimizing search indexes. But there are also tasks that are specific to some modules in Kentico like e-commerce and on-line marketing. One thing that you can easily leverage here is to go through the list of tasks and disable (or delete) the ones that you don’t need in your projects.

If you take a closer look at the tasks you will find one that automatically cleans unused memory. While it can be extremely useful to automatically clear up unused memory, it is a better practice to check your cache settings as your website could be “undercached” or even “overcached”. The “clean unused memory” scheduled task will help you figure out which cache settings works best for your website.

Clean unused memory task

Last but not least: always consider if a scheduled task should be executed by the Kentico web application itself or by a dedicated external Windows service. If you omit reliability and focus on improving performance of your Kentico website, then the best solution is to run the task outside of the Kentico web application. This however requires you to have a Kentico EMS license. The next best thing would be to run the scheduled task in a separate thread which is a setting that you can switch on/off per task. The downside of running tasks in a separate thread is that they cannot access context data like the current page or user. For the out-of-the-box tasks this is automatically configured so you don’t have to worry about it.