How to schedule tasks among many go instances?

xuanbao · · 804 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>There are already good solutions for running scheduled tasks like <a href="https://github.com/rakyll/ticktock">TickTock</a> or <a href="https://github.com/jasonlvhit/gocron">gocron</a> 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&#39;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.</p> <p>I have seen something similar in Java: <a href="http://www.quartz-scheduler.org/">Quartz Framework</a> </p> <hr/>**评论:**<br/><br/>tmornini: <pre><p>How about using a message queue with delayed delivery and/or a start-time encoded in the message?</p></pre>mustafaakin: <pre><p>Do you know any example queue that supports delayed delivery?</p></pre>tmornini: <pre><p>Sure.</p> <p>Amazon SQS</p></pre>mcouturier: <pre><p>beanstalkd. Really easy to run configure </p></pre>Sphax: <pre><p>I&#39;m not aware of any off the shelf solution but if I had to do it I&#39;d use zookeeper and take inspiration from the Java curator framework for things like distributed locks.</p></pre>buckhx: <pre><p>etcd &gt; zookeeper for it&#39;s simplicity and it&#39;s written in go</p></pre>Sphax: <pre><p>Meh. It&#39;s simpler sure, but I&#39;d argue using zookeeper is a safer bet overall, it&#39;s way more mature. </p> <p>As for it being written in Go, I don&#39;t really think it&#39;s a great argument. Sure, I like Go and all other things being equal I&#39;d prefer a Go service just for the ease of debugging, but it&#39;s like at the bottom of the things I look for in a service.</p></pre>sajal: <pre><p>I&#39;m <a href="https://github.com/turbobytes/gomr" rel="nofollow">writing</a> 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. </p> <p>I prefer systems where nodes take up the responsibility to do the work, rather than being told what to do.</p></pre>codepick: <pre><p>You can use github.com/albrow/jobs </p> <p>It only requires redis. It also lets you have delayed and reoccurring jobs. </p></pre>mustafaakin: <pre><p>I love you</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

804 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传