首页  

temporal Workers 为何使用轮询拉取任务     所属分类 temporal 浏览量 824
Workers poll for Tasks in Task Queues via synchronous RPC. This implementation offers several benefits:


Worker Processes do not need to have any open ports, which is more secure.
Worker Processes do not need to advertise themselves through DNS or any other network discovery mechanism.
When all Worker Processes are down, messages simply persist in a Task Queue, waiting for the Worker Processes to recover.
A Worker Processes polls for a message only when it has spare capacity, avoiding overloading itself.
In effect, Task Queues enable load balancing across a large number of Worker Processes.
Task Queues support server-side throttling, which enables you to limit the Task dispatching rate to the pool of Worker Processes while still supporting Task dispatching at higher rates when spikes happen.
Task Queues enable what we call Task Routing, which is the routing of specific Tasks to specific Worker Processes or even a specific process.

All Workers listening to a given Task Queue must have identical registrations of Activities and/or Workflows. 
The one exception is during a Server upgrade, where it is okay to have registration temporarily misaligned while the binary rolls out.

worker通过同步RPC轮询任务队列中的任务,这样实现的几个好处

工作进程不需要有任何开放端口,更安全
工作进程不需要通过DNS或任何其他网络发现机制来发布自己
当所有的工作进程都停止时,消息只是保持在一个任务队列中,等待工作进程恢复
Worker process只在有空闲容量时才轮询消息,以避免本身超载
任务队列可以在大量的工作进程之间实现负载均衡
任务队列支持服务器端节流,能够将任务调度速率限制在工作进程池中,同时仍然支持在峰值发生时以更高的速率进行任务调度。
任务队列启用 任务路由,可将特定的任务路由到特定的Worker进程,甚至是特定的进程

上一篇     下一篇
temporal 一些关键概念

CompletableFuture 实例

scala 泛型 上下界 非变 协变 逆变

temporal list namespace 调试 堆栈信息

vscode 使用技巧

go import 方式