ZeroMQ用户无法使用1000+出版商初始化 [英] ZeroMQ subscriber fails to initialize using 1000+ publishers

查看:637
本文介绍了ZeroMQ用户无法使用1000+出版商初始化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图评估ZeroMQ放大监控和数据采集系统。规模较小的一切工作不错,但加紧负载和规模有点显得棘手。

I am trying to evaluate ZeroMQ for a larger monitoring and data gathering system. On a smaller scale everything works nice but stepping up the load and scale a bit seems tricky.

现在,我使用的是C#包装(clrzmq,3.0.0-RC1),同时创建一个发布者和订户的申请。我绑定发布插槽(1个插座,1上下文)至1000端点(本地主机+端口范围的),让用户的应用程序接口(1再次插槽,1上下文)绑定到出版商的端点。

Right now I am using a C# wrapper (clrzmq, 3.0.0-rc1) to create both a publisher and a subscriber application. I am binding the Publisher socket (1 socket, 1 context) to 1000 endpoints (localhost + a range of ports) and let the Subscriber applications socket (again 1 socket, 1 context) bind to the publisher endpoints.

这有时可行,有时不是(我猜它涉及到的流程处理莫名其妙插座的最大数量)。它似乎取决于以何种顺序我启动应用程序,但我不能告诉是肯定的。我看到的唯一的事情就是讨厌SEHExceptions,不含细节可言。如果我创建简单的控制台应用程序,有时会看到低水平的C ++断言这样的:

This sometimes works, and sometimes not (I guess it relates to the max number of sockets handled by the process somehow). It seems to depend on in which order I start the applications but I cannot tell for sure. The only thing I see is nasty SEHExceptions, containing no details at all. If I create simple console applications I sometimes see low level C++ Asserts like:

  • 断言失败:fds.size()< = FD_SETSIZE(......的\ src \ select.cpp:70)
  • 断言失败:权限被拒绝(...的\ src \ signaler.cpp:281)
  • 断言失败:连接复位(......的\ src \ signaler.cpp:124)

不是对我很有帮助。在C#包装,上下文创建失败。它甚至不会开始连接,甚至创建套接字的机会。我希望低水平ZeroMQ被抛出异常,也许我只是不明白如何处理错误尚未处理的错误。

Not very helpful to me. In the C# wrapper, the Context creation fails. It does not even get a chance to begin connecting to or even creating sockets. I would expect low level ZeroMQ errors to be handled by throwing exceptions, maybe I just have not understood how to deal with errors yet.

我现在的问题是:

  • 如何创建一个(有点)现实的测试设置,模拟一台机器上1000独立出版商(在现实世界中发行1 = 1机)和另一台机器上几个用户,全部采用C#。是,即使可能吗?
  • 更重要的是,我如何在C#code陷阱ZeroMQ错误要能够理解出了问题?

由于ZeroMQ似乎pretty的稳定和成熟的我也很难相信1000出版商应该是一个问题来处理。不过,我需要比目前可用的(除非我完全错过了一些东西在这里),才能使用ZeroMQ对C#更好的错误的支持。

Since ZeroMQ seems pretty stable and mature I have a hard time believing 1000 publishers should be a problem to handle. However, I need better error support than currently available (unless I completely missed something here) in order to use ZeroMQ over C#.

更新:

在陷到源代码,我结束了一个 zmq_assert(...)导致中的RaiseException(0x40000015,EXCEPTION_NONCONTINUABLE,1,extra_info ); 。这倾销原来的断言语句到控制台后,会突然终止应用程序。这似乎有点苛刻,但很可能是最好的选择,因为它实在是不可恢复的。但是,不会伤害一个稍微好一些的错误消息。不是每个人都知道什么 fds.size()< = FD_SETSIZE 表示。在源代码中的注释给出了一些线索,将是不错的错误消息的评论。无论如何,因为我的应用程序是不是一个控制台应用程序,这只是给我留下了未处理的SEHException,这似乎并没有遏制甚至断言语句或行/文件信息。我不知道有多少其他错误,我会创建,这将导致其他类似cryptical错误。

After diggin into the source, I end up with a zmq_assert(...) leading to RaiseException (0x40000015, EXCEPTION_NONCONTINUABLE, 1, extra_info);. This will abruptly terminate the application after dumping the original assert statement to the console. This seems a bit harsh, but may well be the best option given that it is really unrecoverable. However, a somewhat better error message would not hurt. Not everyone knows what fds.size () <= FD_SETSIZE means. The comment in the source gives some clues, would be nice to have that comment in the error message. Anyway, given that my application is not a console app, this just leaves me with an unhandled SEHException, which does not seem to contain even the assert statement or line/file info. I wonder how many other bugs I will create that will result in other similar cryptical errors.

推荐答案

FD_SETSIZE是1024(在MSVC libzmq项目中定义),所以你会打这个大约一半的方式,通过你的测试用例默认。另一个断言从翻滚。

The default FD_SETSIZE is 1024 (defined in the MSVC libzmq project), so you will hit this about half-way through your test case. The other asserts tumble on from that.

这增加你的libzmq工程,4K或8K,事情应该更好地工作。

Increase this in your libzmq project, to 4K or 8K, and things should work better.

对于断言()调用,这太野蛮了在Windows上,是肯定的。在Linux中,这给出了一个体面的堆栈转储和足够的信息来跟踪问题。随意提高断言宏,以便它更聪明的东西,例如:启动调试器。在任何情况下,如果你打的断言,你不能合理地继续下去。

As for the assert() call, it's too brutal on Windows, for sure. On Linux this gives a decent stack dump and enough information to trace the problem. Feel free to improve the assert macro so that it does something smarter, e.g. launch the debugger. In any case if you hit an assert you can't reasonably continue.

断言,当FD集满了,嗯,这可能会处理得更好。如果你知道关于C / C ++的东西,随意看看了code。我们依靠人民的补丁。

Asserting when the FD set is full, well, that could be handled better. If you know anything about C/C++, feel free to take a look at the code. We do depend on peoples' patches.

另外,如果你觉得1024太小,请随时提出这一项目,并给我们的补丁。

Also, if you feel 1024 is too small, feel free to raise this in the project and send us the patch.

这篇关于ZeroMQ用户无法使用1000+出版商初始化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆