哪个 NIO 库(Netty、Grizzly、kryonet...)用于 Java 中的简单后端服务器实现?
我们的前端是简单的 Jetty(稍后可能会替换为 Tomcat)服务器。通过 servlet,我们提供公共 HTTP API(或多或少是 RESTful)来公开我们的产品功能。
在后端,我们有一个 Java 进程,它执行多种维护任务。虽然后端进程通常会在适当的时候执行自己的任务,但前端有时需要唤醒后端以在后台执行某个任务。
哪个 (N)IO 库最适合此任务?我找到了 Netty、Grizzly、kryonet 和普通的 RMI。目前,我倾向于说Netty,它看起来使用起来很简单,而且可能非常可靠。
你们中有人有这种设置的经验吗?你会选择什么?
谢谢!
Our frontend is simple Jetty (might be replaced with Tomcat later on) server. Through servlets, we are providing a public HTTP API (more or less RESTful) to expose our product functionality.
In the backend, we have a Java process which does several kind of maintenance tasks. While the backend process usually does it own tasks when it's time, now and then, the frontend needs to wake-up the backend to execute a certain task in the background.
Which (N)IO library would be ideal for this task? I found Netty, Grizzly, kryonet and plain RMI. For now, I am inclined to say Netty, it seems simple to use and it is probably very reliable.
Does any of you have experience in this kind of setups? What would your choice be?
thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
尝试翻译这份文件来回答您的问题。
http://blog.xebia。 fr/2011/11/09/java-nio-et-framework-web-haute-performance/
这个协会作为法国著名的Java EE专家,在国内做了很多NIO服务器的poc以 VmWare 赞助的法国挑战赛 (USI2011) 为背景。这是关于构建一个简单的测验应用程序,可以处理 100 万连接用户的负载。
他们以优异的成绩赢得了这次挑战。
他们的实现是 Netty + Gemfire,只是用 MemoryAwareThreadPool 替换了 CachedThreadPool。
Netty 似乎提供了出色的性能,并且有很好的文档记录。
他们还考虑过 Deft,其灵感来自 Tornado (python/facebook),但对他们来说仍然有点不成熟
编辑: 这里是 翻译链接在评论中提供
Try to translate this document which answer to your question.
http://blog.xebia.fr/2011/11/09/java-nio-et-framework-web-haute-performance/
This society, as french famous Java EE experts, did a lot of poc of NIO servers in the context of a french challenge sponsored by VmWare (USI2011). It was about building a simple quizz app that can handle a load of 1 million connected users.
They won that challenge with great results.
Their implementation was Netty + Gemfire and they only replaced the CachedThreadPool by a MemoryAwareThreadPool.
Netty seems to offer great performances, and is well documented.
They also considered Deft, inspired by Tornado (python/facebook) but it's still a bit immature for them
Edit: here's the translated link provided in the comments
我最喜欢的是 Netty。它简单而灵活。速度非常快,Netty 周围的社区非常棒。
My preference is Netty. It's simple yet flexible. Very fast and the community around Netty is awesome.
我工作的公司目前正在评估 CoralReactor。它是一个商业软件,但它拥有我所见过的 Java NIO 最简单的 API。我个人的观点是,Netty 让事情变得太复杂了,特别是如果你想要无垃圾和单线程,这是许多金融、广告和游戏行业公司的要求。
The company I work for is currently evaluating CoralReactor. It is a commercial software but it has the easiest API I have ever seen for Java NIO. My personal opinion is that Netty makes things too complicated, especially if you want to go garbage-free and single-threaded, which are a requirement for many companies from the finance, advertisement and game industry.
我会使用 JMS 将它们解耦,只需让您的后端坐在那里监听一些(一组)控制队列,就完成了。无需在这里编写自定义 nio api。
hornetq 是示例提供商之一。它也可以作为进程内 jms 代理运行,它在幕后使用 Netty。
I would decouple them by using JMS, just have some (set of) control queues your backend sits there listening on and you're done. No need to write a custom nio api here.
One sample provider is hornetq. This can be run as an in process jms broker as well, it uses Netty under the covers.