Node.js or Vert.x for Push Notifications

2019-06-03 16:58发布

问题:

I have this java application where the server needs to send push notifications to the client every one second. I am using the HTML5 server sent events to accomplish the one-way communication from the server to the client. However, I am expecting >1000 client connections (which will surely increase) at any point in time connecting to the server to get updates. The duration of these updates may run into 30 mins also. I have read that under such situations when using simple html5 server-sent-events, the server can quickly run out of threads, severely affecting performance.

On evaluation I have come across Node.js and vert.x both of which have the ability to perform server sent events operations. On checking which is a better option, I found on the following link http://vertxproject.wordpress.com/2012/05/09/vert-x-vs-node-js-simple-http-benchmarks/ that vert.x outperforms Node.js.

Based on the information available I am not able to make an informed decision as to which will be a better option for my project considering that I only want to use them for achieving server-sent-events. My main consideration is performance when there are large number of requests.Can anybody please help me based on their experience, whether node.js is a better option or vert.x?

Thank you.

回答1:

in my experience the vertx performance is far away from the nodejs, it outperforms to node for a big margin, but vertx is still experimental and not 100% stable, even worse, the latest version (vertx 3) breaks the compatibility with vertx 2 and it has not documentation yet..

if you only need vertx for communication server/client then it shouldn't be so hard, you can embedded vertx inside your existing app

http://perfectworldprogramming.com/embed-vert-x-eventbus-into-your-spring-application-with-ease/

now, for more complex stuff nodejs could be a better and more tested solution, but if you're in the jvm and you app is in an advanced stage, probably you must keep in the jvm ecosystem, could be vertx, akka or netty...good luck with your choice, vertx,akka,netty and node are really good async solutions