Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strange behavior of quartz in cluster configuration

I'm developing scheduled services.

The application is developed using JDK 1.6, Spring Framework 2.5.6 and Quartz 1.8.4 to schedule jobs.

I've two clustered servers with WebLogic Server 10.3.5.

Sometimes it seems that the scheduling of quartz goes crazy. Analyzing the conditions in which it occurs, there seems to be a clock "desynchronization" greater than a second between the clustered servers. However this desynchronization is not always due to the system time of the servers, sometimes it seems that even if the clocks of the machines are synchronized, there is a little "delay" introduced by the JVM.

Has anyone encountered the same problem? Is there a way to solve it?

Thanks in advance

like image 955
Claudio Query Avatar asked Mar 29 '13 10:03

Claudio Query


People also ask

What is clustering in Quartz?

Quartz's clustering features bring both high availability and scalability to your scheduler via fail-over and load balancing functionality. Clustering currently only works with the JDBC-Jobstore (JobStoreTX or JobStoreCMT), and essentially works by having each node of the cluster share the same database.

How are Quartz properties set?

Configuration of Quartz is typically done through the use of a properties file, in conjunction with the use of StdSchedulerFactory (which consumes the configuration file and instantiates a scheduler). By default, StdSchedulerFactory load a properties file named quartz. properties from the "current working directory".

What is org Quartz JobStore clusterCheckinInterval?

From the Quartz documentation: org. quartz. jobStore. clusterCheckinInterval Set the frequency (in milliseconds) at which this instance "checks-in"* with the other instances of the cluster.

How do I know what version of Quartz I have?

The Quartz package includes a number of jar files, located in root directory of the distribution. The main Quartz library is named quartz-xxx. jar (where xxx is a version number). In order to use any of Quartz's features, this jar must be located on your application's classpath.


3 Answers

When using a JDBC-JobStore on Oracle with version 2.2.1, I experienced the same problem.

In my case, I was running Quartz on a single node. However, I noticed the database machine was not time synchronized with the node running Quartz.

I activated ntpd on both the database machine and the machine running Quartz, and the problem went away after a few minutes.

like image 159
ercasta Avatar answered Oct 21 '22 04:10

ercasta


The issue is most often happens because of de-synchronisation of time in cluster nodes. However it also may be caused by unstable connection of application to DB. Such connection problems may be caused by network problems (if application server and DB server are on different machines) or performance problems (DB server processes requests very slowly by some reason).

In such case chances of appearance of this issue may be reduced by increasing org.quartz.jobStore.clusterCheckinInterval value.

like image 22
Cloud Avatar answered Oct 21 '22 03:10

Cloud


I am using Quartz 2.2.1 and I notice a strange behavior whenever a cluster recovery occurs.

For instance, even if the machines have been synchronized with ntpdate service I obtain this message on cluster instance recovery:

org.quartz.impl.jdbcjobstore.JobStoreSupport findFailedInstances “This scheduler instance () is still active but was recovered by another instance in the cluster. This may cause inconsistent behavior”.

Here says that the solution is: "Synchronize the time on all cluster nodes and then restart the cluster. The messages should no longer appear in the log."

As every machine is synchronized maybe this "delay" is introduced by the JVM?? I don´t know...:(

like image 29
aloplop85 Avatar answered Oct 21 '22 05:10

aloplop85