Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quartz in cluster mode with lockoninsert=false

I have application having 4 nodes. Sometimes all my jobs will be stuck waiting for lock from 'Select * from QRTZ_LOCKS where lock_name='TRIGGER_ACCESS' for update'

While reading some of the articles someone suggested to turn off global lock using this property

org.quartz.jobStore.lockOnInsert=false

Has anyone tried to run Quartz in cluster mode with lockoninsert=false? I am planning to use following configuration

#============================================================================
# Configure Main Scheduler Properties  
#============================================================================

org.quartz.scheduler.instanceName = StandardScheduler
org.quartz.scheduler.instanceId = AUTO

#============================================================================
# Configure ThreadPool  
#============================================================================

org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 3
org.quartz.threadPool.threadPriority = 5

#============================================================================
# Configure JobStore  
#============================================================================

org.quartz.jobStore.misfireThreshold = 300000

org.quartz.jobStore.class=org.springframework.scheduling.quartz.LocalDataSourceJobStore
org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
org.quartz.jobStore.useProperties=false
org.quartz.jobStore.tablePrefix=QRTZ_
org.quartz.jobStore.isClustered=true
org.quartz.jobStore.lockOnInsert=false
org.quartz.jobStore.acquireTriggersWithinLock=true
org.quartz.jobStore.lockHandler.class=org.quartz.impl.jdbcjobstore.UpdateLockRowSemaphore

org.quartz.scheduler.jmx.export=true
like image 697
Javadroider Avatar asked Jul 12 '17 14:07

Javadroider


1 Answers

A found some comment in the 1.8.6' source

    public boolean isLockOnInsert() {
            return lockOnInsert;
        }

        /**
         * Whether or not to obtain locks when inserting new jobs/triggers.  
         * Defaults to <code>true</code>, which is safest - some db's (such as 
         * MS SQLServer) seem to require this to avoid deadlocks under high load,
         * while others seem to do fine without.  
         * 
         * <p>Setting this property to <code>false</code> will provide a 
         * significant performance increase during the addition of new jobs 
         * and triggers.</p>
         * 
         * @param lockOnInsert
         */
like image 92
László Tóth Avatar answered Nov 18 '22 06:11

László Tóth