Live data from Hacker News

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

strongloop.com

11–20 of 59 posts

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

#11
post #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.

That said, saying (concurrent) Node is faster than (nonconcurrent) Language X is several distinct levels of stupid.

If you introduce blocking into an application then to the user it slower, but in terms of computation it could still be faster by some magnitude.

It's like having C block on a network call while having in-browser Javascript concurrently move past it and declaring Javascript faster.

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

#12
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…

PlayFramework (which I can't recommend enough) makes async and continuations super easy in Java.

http://www.playframework.com/documentation/1.2.7/asynchronou...

Play also dramatically improves Java's general... cruftiness.

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

#14
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…

I use akka for much if not all of my heavy lifting on the JVM. Admittedly, it's a little awkward sometimes, but if you make the right tasks non blocking (run it in a future), you would be surprised at the performance increase you can net.

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

#15
post #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.

It's really not.

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

#16
post #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.

Problem is the lack of third party libraries that does IO the way gevent works, if your lib does blocking IO, there is no point using gevent.

NodeJS does async IO by default,so all nodejs libs do async IO.

My point is , it's not so much about wether ruby or python can have the same capabilities as nodejs they can,it's about wether async libs have an ecosystem to support them or not.

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

#17
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…

> Over 50k modules all written in async style, ready to use

Actually, not true in "all" and "ready to use" parts.

I suspect there are enough libraries that, even while exposing supposedly-async API block under the hood. Or require careful handling.

Even core Node libraries are not throughly async. One obvious example is `crypto`, where only I/O stuff (accessing OS entropy pool) is async. Good luck generating a keypair in event loop.

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

#18
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…

http://mailinator.blogspot.com/2008/02/kill-myth-please-nio-...

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

#19
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…

> no server has the non-blocking ecosystem of Node.js today. Over 50k modules all written in the async style, ready to use.

I read it as -- "Node.js doesn't properly support isolated units of concurrency and thus due to being forced to write callbacks inside callbacks that call errbacks for everything, we now have over 50k modules full of callback chains and we call this a GoodThing(tm)".

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

#20
post #16
post #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.

Problem is the lack of third party libraries that does IO the way gevent works, if your lib does blocking IO, there is no point using gevent. NodeJS does async IO by default,so all nodejs libs do async IO. My point is , it's not so much about wether ruby or python can have the same capabilities as nodejs they can,it's about wether async libs have an ecosystem to support them or not.

If you lib uses standard library primitives (sockets, pipes, subprocesses, etc) then gevent.monkey makes it cooperate.
Post reply on HN