Comments (5)
这里的Duration和节点心跳/节点信息有效期有直接关系,如果设置时间过长,当部分节点宕机时其他节点没有及时刷新节点列表可能会导致任务丢失。
另外redis的性能完全足够支撑n个节点(Duration为1的话,并发则为n)的并发请求。
如果节点数量级过大,可以尝试实现etcd driver来满足需求。
from dcron.
func (rd *RedisDriver) heartBear(nodeID string) {
//每间隔timeout/2设置一次key的超时时间为timeout
key := nodeID
tickers := time.NewTicker(rd.timeout / 2)
for range tickers.C {
aa, err := rd.do("EXPIRE", key, int(rd.timeout*10/time.Second))
fmt.Println(aa)
if err != nil {
panic(err)
}
}
}
建议这段代码进行延长有效期的时候,如果返回值为0 时,重新注册一下,不然如果设置值超过一秒,就容易导致节点不执行任务
from dcron.
这个时间建议可以设置,但是可以注明后果是什么,因为5-10秒应该有些人还是能接收的
from dcron.
这个时间建议可以设置,但是可以注明后果是什么,因为5-10秒应该有些人还是能接收的
感谢建议,已经添加可选项
from dcron.
建议将Duration放到可配置项中,不然
func (np *NodePool) tickerUpdatePool() { tickers := time.NewTicker(time.Second * defaultDuration) for range tickers.C { if np.dcron.isRun { np.updatePool() } } }
直接for循环扫描redis,对性能有影响.
from dcron.
Related Issues (20)
- Stable API HOT 4
- api没有recover方法
- 能否发布一个新的release HOT 2
- [Question] 故障转移是怎样实现的?具体逻辑在哪里?为什么是10秒?这个时间可以配置吗? HOT 1
- 新增Driver:仅靠节点间通信同步状态 HOT 2
- 可以考虑包内实现定时任务库 HOT 8
- 添加bash支持 HOT 1
- 提交PR建议 HOT 3
- 集群稳定性维护 HOT 3
- 任务不会平均分配 HOT 5
- 准备做一个具体的应用,可以让大家对dcron的流程进行手动更新和调研 HOT 1
- 可以支持固定间隔的定时任务吗 HOT 1
- 无法打印输出cron的全量日志 HOT 1
- go.opentelemetry.io/otel/metric/sdkapi: module go.opentelemetry.io/otel/metric@latest found (v1.19.0), but does not contain package go.opentelemetry.io/otel/metric/sdkapi HOT 5
- ERR: node pool is empty HOT 4
- 增加codecov看板 HOT 3
- redis内数据量比较大的情况下导致的异常? HOT 1
- 不支持redis集群? HOT 2
- 不支持go1.20 21吗? HOT 1
- stop优化 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dcron.