Java 中是否有与 libevent 相当的工具?
我编写了一个高吞吐量服务器,它在自己的线程中处理每个请求。对于传入的请求,有时需要对一个或多个后端执行 RPC。这些后端 RPC 由单独的队列和线程池处理,这对创建的线程数和后端的最大连接数提供了一些限制(它会进行一些缓存以重用客户端并节省开销)不断地建立联系)。不过,完成所有这些后,我开始认为基于事件的架构会更有效。
在搜索过程中,我没有找到任何与 Java 的 libevent 等效的东西,但也许我没有找对地方? Apache 的 Mina-statemachine 是我发现的最接近的东西,但它看起来比我需要的更详细,而且没有真正的可用版本。
有什么建议吗?
I've written a high-throughput server that handles each request in its own thread. For requests coming in it is occasionally necessary to do RPCs to one or more back-ends. These back-end RPCs are handled by a separate queue and thread-pool, which provides some bounding on the number of threads created and the maximum number of connections to the back-end (it does some caching to reuse clients and save the overhead of constantly creating connections). Having done all this, though, I'm beginning to think an event-based architecture would be more efficient.
In searching around I haven't found any equivalents to libevent for Java, but maybe I'm not looking in the right place? Mina-statemachine from Apache was the closest thing I found, but it looks more verbose than I need and there's no real release available.
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我有点晚了,但是:
你看过 Netty 吗?
或者Grizzly。
I am a bit late but:
Have you looked at Netty?
Or Grizzly.
轻量级事件系统怎么样? :) http://www.lwes.org/ 和 http://sourceforge.net/projects/lwes/files/
How about the Light Weight Event System? :) http://www.lwes.org/ and http://sourceforge.net/projects/lwes/files/
答案似乎是否定的,尽管 Ruby EventMachine 库看起来为 JRuby 用户提供了一个 Java 实现,该实现可能可用,或者至少可以为我自己的编写提供灵感:
http://github.com/eventmachine/eventmachine/tree/master/java/< /a>
The answer seems to be 'no', though it looks like the Ruby EventMachine library provides a Java implementation for JRuby users that might be usable or at least serve as inspiration for writing my own:
http://github.com/eventmachine/eventmachine/tree/master/java/
您可能正在寻找像这样的工作流引擎
JBPM 或列出的任何其他开源工具 此处。
You might be looking for a workflow engine like
JBPM or any other open source tool listed here.