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.

0

3 Answers 3

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!

Sign up to request clarification or add additional context in comments.

2 Comments

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!
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).
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.

4 Comments

I guess what I mean by performance is more about the I/O handling and the V8 engine to perform a task like this.
node.js is really good ar handling load of I/O connections. Event Loop ftw :)
Benchmarking Node + Socket.io on Linux (Dell XPS l502x Laptop) I got Node.js to handle Average of 30,000 Message / Second.
Depends on hardware i was not able too push through redis more then 22k messages / sec on my MacBook Pro
0

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

2 Comments

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).
You need to be careful when using WebSockets... many browsers have their own implementation see here: stackoverflow.com/questions/1253683/… (Also Socket.IO provides for fallbacks such as AJAX Polling)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.