3

I need to consume a JSON-formatted data stream via WebSocket, and send the data as is to a Redis server. That's all this application needs to do; no UI, no requests need to be attended and the data doesn't need to be processed at all.

I want to get the smallest footprint and highest performance. Do you think Node.js/V8 would handle this scenario better than the Java/JVM? I'm between these 2 options because are the ones I can manage, although my main skill is Java.

luisfarzati
  • 8,649
  • 6
  • 29
  • 27

3 Answers3

4

It all depends on the environment that you're installing the application on, and how much experience you have with each.

Nodes event-loop based model is very efficient, however I have found Java to perform better for CPU intensive tasks. I don't consider myself to be an expert on either (approx 10 months Node.js, 3 years part-time Java experience) so don't take my answer as gospel.

In your case you're only really performing I/O which is where Node.js excells, if you're good with JavaScript pick Node!

Jack
  • 15,614
  • 19
  • 67
  • 92
  • You're right, the solely purpose for this app is to consume the stream and send the JSON data to a Redis list. I don't have much experience with Node, although the fact that I know JavaScript well encourages me to try it out! – luisfarzati May 04 '12 at 19:22
  • I've used it for a while and personally seen it grow... from only running on Linux, to having full Windows support. I really enjoy programming Node applications, and my university project was to use WebSockets (Also a great technology). – Jack May 04 '12 at 19:26
3

Node.js and socket.io is easy to setup and deploy in this case. Way easy to deploy. You will be ~20-30mb ram on memory usage problem with metrix on performance here is hard because its hard to benchmark websockets. If its gone not be deployed on heroku then i would go for node.js

You can use node.js + socket.io or node.js / ruby + faye.

With traffic generating < 8k requests / sec it should be fine on both of them with very basic VPS / hardware setup.

I used faye on ruby with 1.1k clients chat over web sockets with 0 problems. And we had peak 4k clients on node.js chat. Very basic hardware.

Jakub Oboza
  • 5,291
  • 1
  • 19
  • 10
0

I would suggest Node.js if you have enough experience with it.

Pablo Santa Cruz
  • 176,835
  • 32
  • 241
  • 292
  • Have you went through this experience? I've seen that implementing a WebSocket client in Node.js is a bit tricky (specially if I don't want to use a browser library). – luisfarzati May 04 '12 at 19:24
  • You need to be careful when using WebSockets... many browsers have their own implementation see here: http://stackoverflow.com/questions/1253683/what-browsers-support-html5-websocket-api (Also Socket.IO provides for fallbacks such as AJAX Polling) – Jack May 04 '12 at 19:27