在 Quartz 集群中选择节点执行作业 [英] Select node in Quartz cluster to execute a job

查看:104
本文介绍了在 Quartz 集群中选择节点执行作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 Quartz 集群有一些疑问,特别是关于触发器如何在集群内执行/作业.

I have some questions about Quartz clustering, specifically about how triggers fire / jobs execute within the cluster.

  1. 在执行作业时,quartz 会优先考虑节点吗?例如总是或从不上次执行相同作业的节点,或者只是哪个节点最先到达作业?

  1. Does quartz give any preference to nodes when executing jobs? Such as always or never the node that executed the same job the last time, or is it simply whichever node that gets to the job first?

是否可以指定执行作业的节点?

Is it possible to specify the node which should execute the job?

推荐答案

对此的答案将是视情况而定".

The answer to this will be something of a "it depends".

对于quartz 1.x,答案是作业的执行始终(仅)在或多或少的随机节点上.随机性"实际上是基于哪个节点首先到达它的.对于繁忙"的调度程序(总是有很多作业要运行),这最终会在集群节点之间提供非常平衡的负载.对于非繁忙的调度程序(仅偶尔触发一个作业),有时看起来像是单个节点正在触发所有作业(因为调度程序会在作业执行完成时寻找下一个要触发的作业 - 因此节点刚刚完成执行倾向于找到下一个要执行的工作).

For quartz 1.x, the answer is that the execution of the job is always (only) on a more-or-less random node. Where "randomness" is really based on whichever node gets to it first. For "busy" schedulers (where there are always a lot of jobs to run) this ends up giving a pretty balanced load across the cluster nodes. For non-busy scheduler (only an occasional job to fire) it may sometimes look like a single node is firing all the jobs (because the scheduler looks for the next job to fire whenever a job execution completes - so the node just finishing an execution tends to find the next job to execute).

对于quartz 2.0(处于测试阶段),答案与上述相同,对于标准quartz.但是 Terracotta 人员已经构建了他们的 TerracottaJobStore 的企业版,它提供了更复杂的集群控制 - 在您安排作业时,您可以指定集群的哪些节点对作业的执行有效,或者您可以指定节点特征/先决条件,例如作为具有至少 100 MB RAM 可用的节点".这也适用于 ehcache,这样您就可以指定要在由 X 键控的数据在本地的节点上"运行的作业.

With quartz 2.0 (which is in beta) the answer is the same as above, for standard quartz. But the Terracotta folks have built an Enterprise Edition of their TerracottaJobStore which offers more complex clustering control - as you schedule jobs you can specify which nodes of the cluster are valid for the execution of the job, or you can specify node characteristics/requisites, such as "a node with at least 100 MB RAM available". This also works along with ehcache, such that you can specify the job to run "on the node where the data keyed by X is local".

这篇关于在 Quartz 集群中选择节点执行作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆