<p>I'm porting a small program from clojure program that will listen for zmq requets, run a slow task (make a psql request) and respond.</p>
<p>I had the thought that because zmq sockets store state internally, this wouldn't work with a simple library - the sockets would need to REP to start listening again. I realized the clojure program uses this library <a href="https://github.com/lynaghk/zmq-async#architecture" rel="nofollow">https://github.com/lynaghk/zmq-async#architecture</a> to work around this. Does this sound right? Is there a go library that can handle async requets?</p>
<hr/>**评论:**<br/><br/>JustTakingANumber3: <pre><p>Zeromq req rep sockets are just straight up broken. We attempted to use them at work, but had issues with blocking calls and issues if the reply service died.</p>
<p>I would recommend looking into http or mangos to get the functionality you need. We are thinking of moving to REST since it would make debugging issues easier.</p>
<p>Cgo has all of the perks of C's memory management and go's debuggability -Dave Cheney</p></pre>babawere: <pre><blockquote>
<p>mangos </p>
</blockquote>
<p>Have you used <a href="https://github.com/go-mangos/mangos" rel="nofollow">mangos</a> in production ? </p></pre>JustTakingANumber3: <pre><p>No I have not. Don't worry about pre optimization. Zeromq is fine for dealer/router and other patterns, but mangos natively supports those. You have to build a lot of code to get them to work as intended in zeromq.</p>
<p>If you are just using req rep then I'd use go http libs for now. In a benchmark we did at work we were able to do 10k requests a second serializing and deserializing protobuffers for v3. </p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传