Is there anything like circus for golang?

agolangf · · 676 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Tons of googling, and I couldn&#39;t really find anything that fit the bill.</p> <p>Does anyone know of a library that has functionality similar to <a href="https://circus.readthedocs.org/en/0.6/library/" rel="nofollow">Circus</a> for Go?</p> <p>Mainly interested in the ability to spawn processes, monitor them (cpu/mem usage, etc) and restart a process if it dies.</p> <hr/>**评论:**<br/><br/>sethammons: <pre><p>Let me start by saying I&#39;m not clear on what problem it is you are trying to solve. </p> <p>I&#39;ve not heard of Circus before, but much of its intro material talks about managing sockets, and that made me think of <a href="https://www.badgerodon.com/socketmaster" rel="nofollow">https://www.badgerodon.com/socketmaster</a>. </p> <p>Is there a reason you don&#39;t want to use something like SupervisorD? Or heck, Circus? It does not look like Circus must be used with solely Python as the docs show it managing Redis. </p> <p>Because concurrency with Python is the way it is (gunicorn, twisted, gevent,...), you often need to spawn and monitor multiple processes and workers. Go&#39;s concurrency is different. You are just going to spawn goroutines; it is not common to explicitly spawn new processes in my experience (I don&#39;t believe I&#39;ve seen a Go process fork, which is what happens in programs like gunicorn). You will have the one Go process. If you need to manage multiple Go processes (ie, different binaries doing different things), then there is no advantage to having a Go arbiter managing them all over any other solution like Supervisord or Circus. If you are wanting to leverage Circus&#39; pub-sub, you may be able to just use ZeroMQ bindings and let Circus do what it already does. </p> <p>I guess what I am getting at is that there are existing tools for managing cpu/mem monitoring and process restarting. What advantage are you wanting to gain by having yet another one written in Go (beyond that it is likely fun to write and perhaps easier to maintain than solutions in other languages)? </p></pre>chootchootchrain: <pre><p>Let me start by saying thanks for the detailed and informative response.</p> <blockquote> <p>(beyond that it is likely fun to write and perhaps easier to maintain than solutions in other languages)? </p> </blockquote> <p>Pretty much hitting the nail on the head.</p> <p>I have an existing project that uses digitalocean&#39;s api to spin up a vps, install my &#39;agent&#39; which is a twisted service, that uses circus to spawn and monitor preconfigured applications on demand. (game servers, etc)</p> <p>I&#39;ve delved into learning Go and think it would be a perfect fit, small binary, likely using less resources.</p></pre>calebdoxsey: <pre><p>Bit of a warning on that socketmaster project: I ran into issues where it would get stuck - I think because the underlying yamux library had problems. (Which incidentally we&#39;ve seen at work in consul causing massive headaches)</p></pre>ecnahc515: <pre><p>Why not use systemd?</p></pre>XANi_: <pre><p>For all the flak it gets for having everything and kitchen sink, it is a pretty good tool to supervise/limit daemons</p></pre>ecnahc515: <pre><p>Yup and it has socket activation which is is something Circus does in a different way</p></pre>XANi_: <pre><p>It would be nice if things that I&#39;d actually want to start on first request (test mysql/es/influxdb DB instance) would support that...</p></pre>lstep: <pre><p>Looks like suture (<a href="https://github.com/thejerf/suture" rel="nofollow">https://github.com/thejerf/suture</a>) would match, but alas it doesn&#39;t seem to have been updated for some time...</p></pre>jerf: <pre><p>I haven&#39;t updated it because it&#39;s mature. It&#39;s in use by me quite extensively and if you hit the <a href="http://godoc.org/github.com/thejerf/suture?importers" rel="nofollow">godoc reverse lookup</a> others are using it too. The system I was going to think of as the benchmark is still in alpha (big system), but it&#39;s used in enough other places.</p></pre>chootchootchrain: <pre><p>Thanks, I&#39;ll be looking into suture later tonight.</p></pre>chootchootchrain: <pre><p>Thanks for the link.</p> <p>At least the readme on the repo is up to date, was updated 4 hours ago.</p></pre>Martin_Ehrental: <pre><p>You could Docker and its restart policy: <a href="https://docs.docker.com/reference/run/#restart-policies-restart" rel="nofollow">https://docs.docker.com/reference/run/#restart-policies-restart</a></p></pre>

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

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