Skip to content

Commit

Permalink
Expose configuration for quartz scheduler performance tuning
Browse files Browse the repository at this point in the history
  • Loading branch information
fikrutm committed Nov 21, 2022
1 parent c0e0cbb commit 9b61473
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ public class QuartzRuntimeConfig {
@ConfigItem(defaultValue = "QuarkusQuartzScheduler")
public String instanceName;

/**
* The amount of time in milliseconds that a trigger is allowed to be acquired and fired ahead of its scheduled fire time.
*/
@ConfigItem(defaultValue = "0")
public long batchTriggerAcquisitionFireAheadTimeWindow;

/**
* The maximum number of triggers that a scheduler node is allowed to acquire (for firing) at once.
*/
@ConfigItem(defaultValue = "1")
public int batchTriggerAcquisitionMaxCount;
/**
* The size of scheduler thread pool. This will initialize the number of worker threads in the pool.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,10 @@ private Properties getSchedulerConfigurationProperties(QuartzSupport quartzSuppo
props.put(StdSchedulerFactory.PROP_SCHED_INSTANCE_ID, "AUTO");
props.put("org.quartz.scheduler.skipUpdateCheck", "true");
props.put(StdSchedulerFactory.PROP_SCHED_INSTANCE_NAME, quartzSupport.getRuntimeConfig().instanceName);
props.put(StdSchedulerFactory.PROP_SCHED_BATCH_TIME_WINDOW,
quartzSupport.getRuntimeConfig().batchTriggerAcquisitionFireAheadTimeWindow);
props.put(StdSchedulerFactory.PROP_SCHED_MAX_BATCH_SIZE,
quartzSupport.getRuntimeConfig().batchTriggerAcquisitionMaxCount);
props.put(StdSchedulerFactory.PROP_SCHED_WRAP_JOB_IN_USER_TX, "false");
props.put(StdSchedulerFactory.PROP_SCHED_SCHEDULER_THREADS_INHERIT_CONTEXT_CLASS_LOADER_OF_INITIALIZING_THREAD, "true");
props.put(StdSchedulerFactory.PROP_THREAD_POOL_CLASS, "org.quartz.simpl.SimpleThreadPool");
Expand Down

0 comments on commit 9b61473

Please sign in to comment.