I am new to Quartz Scheduler Framework. We are using quartz 2.3.2 for scheduling jobs. I have around million scheduled jobs, which has different frequencies. But mostly I get 6000-7000 triggers every minute. These jobs are very light on computation side, they just publish message over rabbit. I am using postgres database to persist these jobs. I have a cluster of scheduler service instances to handle the scale.
I have all schedules as crontriggers with misfire policy as “MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY”.
Quartz configuration:
spring:
application:
name: my-scheduler-service
quartz:
job-store-type: jdbc
jdbc:
initialize-schema: never # Let Flyway handle initialization
properties.org.quartz:
scheduler:
batchTriggerAcquisitionMaxCount: 600
instanceName: JobScheduler
instanceId: AUTO
threadPool:
class: org.quartz.simpl.SimpleThreadPool
threadCount: 600 # Todo: determine appropriate size here
threadPriority: 5
jobStore:
maxMisfiresToHandleAtATime: 400
acquireTriggersWithinLock: true
isClustered: true
driverDelegateClass: org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
resources:
global:
enabled: true
url:
hikari:
poolName: GlobalDBPool
minimumIdle: 20
maximumPoolSize: 50
Problems
- We have deployed the service on Kubernetes with 4 pods. Unfortunately, we are seeing huge delay in task executing. Resulting in huge number of misfires. We are not able to catchup to this misfires and live jobs are not getting triggered.
- We also observed that quartz locking was taking time (70-74 sec’s). Mostly this is for “SELECT * FROM QRTZ_LOCKS WHERE SCHED_NAME = ? AND LOCK_NAME = $1 FOR UPDATE” query.
What are the things I can do to improve the quartz performance?
Are these tasks executed concurrently? If it is executed concurrently and each task execution needs to establish a connection with the database, according to your description, “But mostly I get 6000-7000 triggers every minute”, I suggest increasing the number of connections configured in the database connection pool.Your maximumPoolSize has only been set to 50.
hxx is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1