I understand that we create database agent in Sitecore Configuration and provide Schedule root to it. Inside schedule root we have different tasks for which we define interval similarly on database agent also we define interval. How it exactly works? what care we have to take while defining time interval between this two? Performance point of view what is the best practice?
You're right. There is a database agent configured in Sitecore configuration, e.g. for
<agent name="Master_Database_Agent" type="Sitecore.Tasks.DatabaseAgent" method="Run" interval="00:10:00"> <param desc="database">master</param> <param desc="schedule root">/sitecore/system/tasks/schedules</param> <LogActivity>true</LogActivity> </agent>
In the situation above, agent checks every 10 minutes if any of the scheduled tasks defined in database should be executed now. And
sync scheduled task should be executed every 7 days.
If only 6 days 23 hours and 57 minutes passed, the task will not be executed by the agent. And if your agent runs again after 10 minutes (value from the config), your scheduled task will be executed after 7 days and 7 minutes after it was executed last time.
- agent configuration defines how often Sitecore should check if any of the tasks should be executed
- scheduled task
Schedulefield defines minimum time between tasks execution (not the exact time).
Assuming that you don't have too many tasks defined in your database, you can safely change the
interval of agent to a lower value, like 10 seconds
interval="00:00:10". Sitecore will only check values on few items but will not execute any action unless scheduled task is ready to be executed again. That will make sure that your tasks will be executed with 10 seconds delay max comparing to what's defined in their