Live data from Hacker News

What makes Node.js faster than Java? In a nutshell, it's all about concurrency

strongloop.com

1–10 of 59 posts

Re: What makes Node.js faster than Java? In a nutshell, it's all about concurrency

#3
Yea. This headline has to be troll bait. NodeJS is not faster than Java, and it's also not Concurrent. It is single threaded. It makes efficient use of that single thread with an event-oriented model.

That said, I tend to prefer building in NodeJS because it's fast enough for most (unanticipated) use cases.

Re: What makes Node.js faster than Java? In a nutshell, it's all about concurrency

#4
I wouldn't be so sure with this statement: take a look at techempower's frameworks benchmarks and compare best configurations of NodeJS and PlayFramework (via genius Netty):

http://www.techempower.com/benchmarks/#section=data-r8&hw=i7...

NodeJS is far behind with 55% vs PlayFramework 67% on 20-queries test.

Re: What makes Node.js faster than Java? In a nutshell, it's all about concurrency

#5
At first, I was ready to dismiss this article completely. However, this paragraph:

"While Java or Node or something else may win a benchmark, no server has the non-blocking ecosystem of Node.js today. Over 50k modules all written in the async style, ready to use. Countless code examples strewn about the web. Lessons and tutorials all using the async style. Debuggers, monitors, loggers, cluster managers, test frameworks and more all expecting your code to be non-blocking async."

is true.

Java has had all of the same async capabilities for many, many years, but nobody uses them because the blocking paradigm is simply easier.

That said, if true scalability is required, I'd suggest living with Akka and the cleaner actors paradigm. However, it's true that eventually you're going to run into the barrier that the vast majority of the java ecosystem is built on blocking io.

(That said, with Java 8, I think we have a real opportunity to change that. I think a parallel "lean java" ecosystem is coming.)

Re: What makes Node.js faster than Java? In a nutshell, it's all about concurrency

#6

Yea. This headline has to be troll bait. NodeJS is not faster than Java, and it's also not Concurrent. It is single threaded. It makes efficient use of that single thread with an event-oriented model. That said, I tend to prefer building in NodeJS because it's fast enough for most (unanticipated) use cases.

There's a difference between concurrency and parallelism. Concurrency is about a programming model for doing multiple independent tasks while parallelism refers to doing them at the same time. For example with node, you can handle requests while waiting for an asynchronous io task like reading a file.

http://blog.golang.org/concurrency-is-not-parallelism

Re: What makes Node.js faster than Java? In a nutshell, it's all about concurrency

#7
I'm always wondering why gevent never gets the same attention other concurrency frameworks do. From my point of view it looks like a very sweet library with useful tools and should work just fine in combination with gunicorn or uwsgi. I never had a chance to test it with some real work load though.

Re: What makes Node.js faster than Java? In a nutshell, it's all about concurrency

#8

Yea. This headline has to be troll bait. NodeJS is not faster than Java, and it's also not Concurrent. It is single threaded. It makes efficient use of that single thread with an event-oriented model. That said, I tend to prefer building in NodeJS because it's fast enough for most (unanticipated) use cases.

Your operating system is concurrent even if it's single threaded.

Concurrency is about doing things in the same time period not necessarily at the exact same time.

Re: What makes Node.js faster than Java? In a nutshell, it's all about concurrency

#9
post #5

At first, I was ready to dismiss this article completely. However, this paragraph: "While Java or Node or something else may win a benchmark, no server has the non-blocking ecosystem of Node.js today. Over 50k modules all written in the async style, ready to use. Countless code examples strewn about the web. Lessons and tutorials all using the async style. Debuggers, monitors, loggers, cluster managers, test framewor…

Re: "Java has had all of the same async capabilities for many, many years, but nobody uses them"

That's exaggeration.

Lots of Java libraries use async and concurrency. Java 7 has NIO.2 which is easy to use. There is also Netty; many projects build upon that.

I'm not here to say Java's ecosystem is richer or better; I'm just saying exaggeration is not useful.

Re: "the vast majority of the java ecosystem" I don't mean to sound dismissive, but lots of languages have code you probably don't want to use based on your preferences or needs. So? Don't use the vast majority of libraries. :) You probably don't anyway.

UPDATE: See also Akka and Clojure's concurrency for useful, popular approaches for the JVM.

Re: What makes Node.js faster than Java? In a nutshell, it's all about concurrency

#10

Yea. This headline has to be troll bait. NodeJS is not faster than Java, and it's also not Concurrent. It is single threaded. It makes efficient use of that single thread with an event-oriented model. That said, I tend to prefer building in NodeJS because it's fast enough for most (unanticipated) use cases.

Node offers parallelism through load balanced processes. See cluster.
Post reply on HN