Skip to content

Commit

Permalink
Merge pull request quarkusio#29395 from fikrutm/main
Browse files Browse the repository at this point in the history
Expose configuration for quartz scheduler performance tuning
  • Loading branch information
machi1990 authored Dec 2, 2022
2 parents 8620cf4 + 76e703f commit b82d50f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
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 All @@ -581,9 +585,9 @@ private Properties getSchedulerConfigurationProperties(QuartzSupport quartzSuppo
quartzSupport.getDriverDialect().get());
props.put(StdSchedulerFactory.PROP_DATASOURCE_PREFIX + "." + dataSource + ".connectionProvider.class",
QuarkusQuartzConnectionPoolProvider.class.getName());
props.put(StdSchedulerFactory.PROP_JOB_STORE_PREFIX + ".acquireTriggersWithinLock", "true");
if (buildTimeConfig.clustered) {
props.put(StdSchedulerFactory.PROP_JOB_STORE_PREFIX + ".isClustered", "true");
props.put(StdSchedulerFactory.PROP_JOB_STORE_PREFIX + ".acquireTriggersWithinLock", "true");
props.put(StdSchedulerFactory.PROP_JOB_STORE_PREFIX + ".clusterCheckinInterval",
"" + quartzSupport.getBuildTimeConfig().clusterCheckinInterval);
if (buildTimeConfig.selectWithLockSql.isPresent()) {
Expand Down

0 comments on commit b82d50f

Please sign in to comment.