Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quartz Scheduler Worker Threads Issue

I have a problem with Quartz Scheduler worker threads. I created a scheduler task and it will execute for every 3 hours. I created one job and one trigger. When I executed this scheduler I observed a weird behavior the same job was assigned to 10 worker threads. These 10 worker threads are executing the same code 10 times. How can I solve this issue...?

Can anyone please help me on this. I am very new to Quartz Scheduler.

Thanq In Advance, Amar

like image 319
Amar Avatar asked Oct 24 '25 03:10

Amar


2 Answers

From the quartz manual under the org.quartz.threadPool.threadCount header

If you only have a few jobs that fire a few times a day, then 1 thread is plenty! If you have tens of thousands of jobs, with many firing every minute, then you probably want a thread count more like 50 or 100 (this highly depends on the nature of the work that your jobs perform, and your systems resources!).

This is how threadCount can be changed .

<configSections>
    <section name="quartz" type="System.Configuration.NameValueSectionHandler,System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>

<quartz>
    <add key="quartz.scheduler.instanceName" value="ServerScheduler" />
    <add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" />
    <add key="quartz.threadPool.threadCount" value="80" />
    <add key="quartz.threadPool.threadPriority" value="2" />
    <add key="quartz.jobStore.misfireThreshold" value="60000" />
    <add key="quartz.jobStore.type" value="Quartz.Simpl.RAMJobStore, Quartz" />
</quartz>
like image 107
dush88c Avatar answered Oct 26 '25 08:10

dush88c


First of all check out your cronExpression like "0 0 */3 * *"

Or change your threads count.

<property name="quartzProperties">
    <map>
        <entry key="org.quartz.threadPool.threadCount" value="10"/>
    </map>
</property>
like image 21
rockmkd Avatar answered Oct 26 '25 09:10

rockmkd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!