There are already good solutions for running scheduled tasks like TickTock or gocron but there is no solution for distributed environments. I just want to schedule tasks among some intervals and have them executed properly, i.e one node gets task when interval time comes and others don't etc. If there is no solution, I will be implementing it myself but I am no distributed-systems guy and it will probably fail, so any recommendations would be appreciated.
I have seen something similar in Java: Quartz Framework
评论:
tmornini:
mustafaakin:How about using a message queue with delayed delivery and/or a start-time encoded in the message?
tmornini:Do you know any example queue that supports delayed delivery?
mcouturier:Sure.
Amazon SQS
Sphax:beanstalkd. Really easy to run configure
buckhx:I'm not aware of any off the shelf solution but if I had to do it I'd use zookeeper and take inspiration from the Java curator framework for things like distributed locks.
Sphax:etcd > zookeeper for it's simplicity and it's written in go
sajal:Meh. It's simpler sure, but I'd argue using zookeeper is a safer bet overall, it's way more mature.
As for it being written in Go, I don't really think it's a great argument. Sure, I like Go and all other things being equal I'd prefer a Go service just for the ease of debugging, but it's like at the bottom of the things I look for in a service.
codepick:I'm writing a map/reduce system in Go that uses etcd to manage locks, very simple and easy to implement. Each idle nodes try to acquire a lock, the one that succeeds does the job.
I prefer systems where nodes take up the responsibility to do the work, rather than being told what to do.
mustafaakin:You can use github.com/albrow/jobs
It only requires redis. It also lets you have delayed and reoccurring jobs.
I love you
