节点。用于Comet应用程序的js和Java

时间:2022-06-29 05:15:26

We look to build a high-performance, scalable Comet server, and thought first about using Java Grizzly with GlassFish.

我们希望构建一个高性能、可伸缩的Comet服务器,并首先考虑在GlassFish中使用Java Grizzly。

But after some research, we see that Node.JS is taking rapidly as the preferred choice due to extreme simplicity, and claimed performance:

但是经过一些研究,我们看到了这个节点。JS由于极其简单,正迅速成为首选,并声称性能:

http://news.ycombinator.com/item?id=1088699

http://news.ycombinator.com/item?id=1088699

http://amix.dk/blog/post/19484

http://amix.dk/blog/post/19484

I will be happy to hear some real-life experience of using both, and what ultimately can be the best choice down the road.

我将很高兴地听到一些现实生活中使用这两种方法的经验,以及最终可能是最好的选择。

Thanks!

谢谢!

4 个解决方案

#1


13  

If you would further read the blog posts by the same author, namely the post, Is node.js best for Comet, he explains why he again went back to the Java based solution (Netty) and is happy with it. I guess that would be an interesting read.

如果你想进一步阅读同一作者的博文,也就是博文,那就是node。js最适合Comet,他解释了为什么他再次回到基于Java的解决方案(Netty),并对它感到满意。我想这是一本有趣的读物。

#2


5  

I know this is an old and already answered question but I think my experience can be helpful.

我知道这是一个老生常谈的问题,但我认为我的经验是有帮助的。

I started a little pet project to test Node.js - how it "feels" and how to program on it. I became impressed by the ease of working in such ecosystem: Node.js code is easy to write (although its asynchronous paradigm is not that straightforward for the conventional programmer), libraries are easy to build etc. etc. Even npm is amazingly easy: I just found the most straightforward way to provide code of your own as a library is to make a public package of it!

我启动了一个小型pet项目来测试Node。如何“感觉”和如何编程。在Node这样的生态系统中工作的便利给我留下了深刻的印象。js代码容易编写(尽管它的异步模式不是简单的传统程序员),图书馆很容易构建等等。甚至npm非常简单:我刚发现最直截了当的方式,提供自己的代码作为一个图书馆是公共包!

However, there is not much good tools to work with Node.js. Maybe because it is too easy to do anything, most libraries are partially-implemented, undocumented solutions (and I am guilty too).

但是,没有多少好的工具可以与Node.js一起工作。可能因为它太容易做任何事情,大多数库都是部分实现的,无证的解决方案(我也很内疚)。

Also, note that the relevant difference of Node.js is not the JavaScript language, but the asynchronous I/O model. It is the most interesting aspect of Node.js, but the asynchronous programming style is not as well tested as the conventional way of web development. Maybe it is really the marvel that is propagandized - or perhaps, it is not as good as promised.

注意节点的相关差异。js不是JavaScript语言,而是异步I/O模型。它是Node最有趣的方面。但是异步编程风格并没有像传统的web开发方式那样得到很好的测试。也许它真的是宣传的奇迹——或者,它没有承诺的那么好。

Even in the case it pays off, will you have enough developers to maintain such an (at least still) unusual codebase? If you can get a lot of advantages from the asynchronous "way of life" of Node.js, you can use more consolidated languages and frameworks, such as Twisted for Python (which is my preferred languabe, so take care with my opinion :) ). There may be something like this for Java, too. Anyway, I suspect that you do not have a lot of interest in this model for now, since your question focuses more on languages than in the programming paradigm, so Node.js does not have much to offer to you anyway.

即便如此,您是否有足够的开发人员来维护这样一个(至少是)不寻常的代码基?如果你能从节点的异步“生活方式”中获得很多优势。js,您可以使用更统一的语言和框架,如用于Python的Twisted(这是我比较喜欢的语言,所以请注意我的观点:)。Java也可能有类似的东西。无论如何,我怀疑您目前对这个模型不太感兴趣,因为您的问题更多地关注语言而不是编程范式,因此Node。js无论如何都没有什么可以提供给你的。

So... no, I would not develop something professonaly in Node.js for now, although I think it is both fun and instructive to study.

所以…不,我不会在Node开发一些专业的东西。就目前而言,虽然我认为学习既有趣又有益。

#3


3  

In my opinion the asynchronous approach for Comet glorified in Node.JS and Grizzly is deeply flawed.

在我看来,Comet的异步方法在Node中得到了美化。JS和Grizzly有严重的缺陷。

#4


2  

In a more recent test (August 2012), Node.js was able to handle 1 million single connections from a single 16GB RAM Server.

在最近的一次测试中(2012年8月),Node。js能够处理来自一个16GB RAM服务器的100万个单个连接。

http://blog.caustik.com/2012/08/19/node-js-w1m-concurrent-connections/

http://blog.caustik.com/2012/08/19/node-js-w1m-concurrent-connections/

#1


13  

If you would further read the blog posts by the same author, namely the post, Is node.js best for Comet, he explains why he again went back to the Java based solution (Netty) and is happy with it. I guess that would be an interesting read.

如果你想进一步阅读同一作者的博文,也就是博文,那就是node。js最适合Comet,他解释了为什么他再次回到基于Java的解决方案(Netty),并对它感到满意。我想这是一本有趣的读物。

#2


5  

I know this is an old and already answered question but I think my experience can be helpful.

我知道这是一个老生常谈的问题,但我认为我的经验是有帮助的。

I started a little pet project to test Node.js - how it "feels" and how to program on it. I became impressed by the ease of working in such ecosystem: Node.js code is easy to write (although its asynchronous paradigm is not that straightforward for the conventional programmer), libraries are easy to build etc. etc. Even npm is amazingly easy: I just found the most straightforward way to provide code of your own as a library is to make a public package of it!

我启动了一个小型pet项目来测试Node。如何“感觉”和如何编程。在Node这样的生态系统中工作的便利给我留下了深刻的印象。js代码容易编写(尽管它的异步模式不是简单的传统程序员),图书馆很容易构建等等。甚至npm非常简单:我刚发现最直截了当的方式,提供自己的代码作为一个图书馆是公共包!

However, there is not much good tools to work with Node.js. Maybe because it is too easy to do anything, most libraries are partially-implemented, undocumented solutions (and I am guilty too).

但是,没有多少好的工具可以与Node.js一起工作。可能因为它太容易做任何事情,大多数库都是部分实现的,无证的解决方案(我也很内疚)。

Also, note that the relevant difference of Node.js is not the JavaScript language, but the asynchronous I/O model. It is the most interesting aspect of Node.js, but the asynchronous programming style is not as well tested as the conventional way of web development. Maybe it is really the marvel that is propagandized - or perhaps, it is not as good as promised.

注意节点的相关差异。js不是JavaScript语言,而是异步I/O模型。它是Node最有趣的方面。但是异步编程风格并没有像传统的web开发方式那样得到很好的测试。也许它真的是宣传的奇迹——或者,它没有承诺的那么好。

Even in the case it pays off, will you have enough developers to maintain such an (at least still) unusual codebase? If you can get a lot of advantages from the asynchronous "way of life" of Node.js, you can use more consolidated languages and frameworks, such as Twisted for Python (which is my preferred languabe, so take care with my opinion :) ). There may be something like this for Java, too. Anyway, I suspect that you do not have a lot of interest in this model for now, since your question focuses more on languages than in the programming paradigm, so Node.js does not have much to offer to you anyway.

即便如此,您是否有足够的开发人员来维护这样一个(至少是)不寻常的代码基?如果你能从节点的异步“生活方式”中获得很多优势。js,您可以使用更统一的语言和框架,如用于Python的Twisted(这是我比较喜欢的语言,所以请注意我的观点:)。Java也可能有类似的东西。无论如何,我怀疑您目前对这个模型不太感兴趣,因为您的问题更多地关注语言而不是编程范式,因此Node。js无论如何都没有什么可以提供给你的。

So... no, I would not develop something professonaly in Node.js for now, although I think it is both fun and instructive to study.

所以…不,我不会在Node开发一些专业的东西。就目前而言,虽然我认为学习既有趣又有益。

#3


3  

In my opinion the asynchronous approach for Comet glorified in Node.JS and Grizzly is deeply flawed.

在我看来,Comet的异步方法在Node中得到了美化。JS和Grizzly有严重的缺陷。

#4


2  

In a more recent test (August 2012), Node.js was able to handle 1 million single connections from a single 16GB RAM Server.

在最近的一次测试中(2012年8月),Node。js能够处理来自一个16GB RAM服务器的100万个单个连接。

http://blog.caustik.com/2012/08/19/node-js-w1m-concurrent-connections/

http://blog.caustik.com/2012/08/19/node-js-w1m-concurrent-connections/