Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is the Sitecore keepalive task set to 1 hour by default?

The sitecore keepalive task set in web.config which calls a 'keepalive' url is configured to run every hour by default:

<agent type="Sitecore.Tasks.UrlAgent" method="Run" interval="01:00:00">
  <param desc="url">/sitecore/service/keepalive.aspx</param>
  <LogActivity>true</LogActivity>
</agent>

If the default IIS application pool timeout is 20 minutes, does this not mean that the keepalive function will not work in its default configured state? i.e. a site left idle will invoke this task once at most, potentially keeping the site alive for a further 20 minutes whereupon it will timeout and unload until a real external request arrives.

Unless I'm missing something, this setting should be set to something under 20 minutes (or rather 20min minus the scheduler interval) to work as expected, right?

like image 918
Paul George Avatar asked Feb 03 '23 07:02

Paul George


1 Answers

You are correct that 1 hour is likely too high. By default the keep-alive agent does not work fully out of the box anyway. There are typically two things you need to do to ensure it works best:

  1. Adjust the time to be more appropriate as you've mentioned. I like to do every 15 minutes personally: interval="00:15:00"
  2. Adjust the path to be absolute to your site, not relative. By default, the path /sitecore/service/keepalive.aspx will only make a request to your site if your site is configured in IIS to bind on localhost. The code in the UrlAgent assumes its requesting http://localhost/sitecore/service/keepalive.aspx. 99% of the time you'd want to adjust this to be a public URL to your site, e.g. http://www.mysite.com/sitecore/service/keepalive.aspx
like image 74
Mark Ursino Avatar answered Apr 07 '23 01:04

Mark Ursino