Quartz.NET with AdoNetJobStore efficiency

I have ~ 5M Jobs and each Job has exactly one trigger scheduled in Quartz.Net, since there is a maximum of 300,000 jobs scheduled to run at the same time, I have a limit to continue all 300K Jobs within 3 hours (so ~ 100K Jobs / Hour), but now my test app can only run 10K per hour when Quartz.Net is configured to use AdoNetJobStore.

I am using the following Quartz configuration:

<quartz>
    <add key="quartz.scheduler.instanceName" value="XxxDefaultQuartzScheduler" />
    <add key="quartz.scheduler.instanceId" value="instance_one" />
    <add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" />
    <add key="quartz.threadPool.threadCount" value="10" />
    <add key="quartz.threadPool.threadPriority" value="1" />
    <add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" />
    <add key="quartz.jobStore.misfireThreshold" value="60000" />
    <add key="quartz.jobStore.dataSource" value="default" />
    <add key="quartz.jobStore.driverDelegateType" value="Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz" />
    <add key="quartz.jobStore.lockHandler.type" value="Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz" />
    <add key="quartz.jobStore.tablePrefix" value="QRTZ_" />
    <add key="quartz.jobStore.useProperties" value="false" />
    <add key="quartz.dataSource.default.connectionStringName" value="QuartzDbContext" />
    <add key="quartz.dataSource.default.provider" value="SqlServer-20" />
</quartz>

      

Can Quartz.Net be tuned with the SQL Job Store to achieve this kind of performance?

+3


source to share


1 answer


The default stream value of 10 is rather low for this kind of mass use. I would increase it to about 25 x cores in a computer. Naturally, you can also check for higher values. Modern hardware should be able to handle 100-200 streams, but stream collision can arise as a problem.

You didn't mention the version you are using, but with newer versions you can opt out of quartz.jobStore.lockHandler.type, it uses optimized row locking when it detects that SQL Server is in use. Always use the latest version (2.2.x series), the most optimized and bug free.

After setting up the Quartz configuration, you should of course profile your own job code. Tell your code to be able to complete in 5 seconds, so we'll roughly have:



5 seconds * 300,000 triggers / 100 threads => 15,000 seconds ~ 250 minutes ~ 4 hours

Drop that five seconds runtime down to three and you'll be putting the 2h 30m mark.Or just raise the number of threads and be ready to battle for resources - depending on what your missions are doing and how.

Another consideration might be clustering, running multiple workers against the Quartz database if the database is not the bottleneck.

+3


source







All Articles