Nodejs VS Netty.

2,336 views
Skip to first unread message

曹江华

unread,
Sep 17, 2010, 2:08:13 PM9/17/10
to nodejs
Nodejs and Netty, which is best?

--
http://www.caojianghua.com

Stephen Belanger

unread,
Sep 17, 2010, 2:16:20 PM9/17/10
to nod...@googlegroups.com
nodejs.

You are asking this on the nodejs mailing list, were you expecting an unbiased response?

nodejs is c++ and V8 which is very speedy, while Netty is Java-based which tends to be slower. I haven't used it personally, so I can't comment on it's functionality, but I would bet node would be the pants off it in terms of performance.

I'd recommend looking at the documentation for both and deciding for yourself what fits your coding style best.

--
You received this message because you are subscribed to the Google Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com.
To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nodejs?hl=en.

francisco treacy

unread,
Sep 18, 2010, 9:07:15 AM9/18/10
to nod...@googlegroups.com
http://blog.urbanairship.com/blog/2010/08/24/c500k-in-action-at-urban-airship/


2010/9/17 Stephen Belanger <cyruz...@gmail.com>:


> nodejs.
> You are asking this on the nodejs mailing list, were you expecting an
> unbiased response?
> nodejs is c++ and V8 which is very speedy, while Netty is Java-based which
> tends to be slower. I haven't used it personally, so I can't comment on it's
> functionality, but I would bet node would be the pants off it in terms of
> performance.
> I'd recommend looking at the documentation for both and deciding for
> yourself what fits your coding style best.
>

Marco Rogers

unread,
Sep 18, 2010, 9:57:21 AM9/18/10
to nodejs
Questions like this and answers like the one Stephen gave are always
funny to me. Define "best". If you define "best" as "way faster"
then node probably wins. If you define best as "fast enough, plus
access to a huge library of battle tested libraries" then Netty beats
the pants off node because it's on the jvm. I define "best" as "don't
have to write java". Hence, node wins hands down.

But seriously, I've only messed with netty in a tinkering type of
way. It works, and it's pretty fast. But it's a painful dev process
unless you're very comfortable with java. I realized I didn't have
the patience for it anymore.

Sorry, I just realized this isn't very helpful :)

:Marco

On Sep 18, 9:07 am, francisco treacy <francisco.tre...@gmail.com>
wrote:
> http://blog.urbanairship.com/blog/2010/08/24/c500k-in-action-at-urban...
>
> 2010/9/17 Stephen Belanger <cyruzdr...@gmail.com>:
>
>
>
> > nodejs.
> > You are asking this on the nodejs mailing list, were you expecting an
> > unbiased response?
> > nodejs is c++ and V8 which is very speedy, while Netty is Java-based which
> > tends to be slower. I haven't used it personally, so I can't comment on it's
> > functionality, but I would bet node would be the pants off it in terms of
> > performance.
> > I'd recommend looking at the documentation for both and deciding for
> > yourself what fits your coding style best.
>

Dean Landolt

unread,
Sep 18, 2010, 10:02:48 AM9/18/10
to nod...@googlegroups.com
On Sat, Sep 18, 2010 at 9:57 AM, Marco Rogers <marco....@gmail.com> wrote:
Questions like this and answers like the one Stephen gave are always
funny to me.  Define "best".  If you define "best" as "way faster"
then node probably wins.  If you define best as "fast enough, plus
access to a huge library of battle tested libraries" then Netty beats
the pants off node because it's on the jvm.  I define "best" as "don't
have to write java".  Hence, node wins hands down.

But seriously, I've only messed with netty in a tinkering type of
way.  It works, and it's pretty fast.  But it's a painful dev process
unless you're very comfortable with java.  I realized I didn't have
the patience for it anymore.

Sorry, I just realized this isn't very helpful :)


Unless, of course, you wrap netty with rhino. If someone's bored it'd be really sweet to implement the node API (or some reasonably approximation) on narwhal with the netty stuff. Now you have the best of both worlds (except that rhino's still going to be slower than v8, but if you're io bound who cares?)

Bradley Meck

unread,
Sep 18, 2010, 10:42:25 AM9/18/10
to nodejs
i agree having nodes api moved to rhino could be interesting, however,
most of the tools in java just dont sync with node. Java is based
largely on the idea that threaded systems are great (look at the
synchronized keyword). It's APIs are blocking except NIO (which has
virtually no optimization). You could give the node implementation on
it a single thread per async call, but then its just doing what Java
would do to begin with.

on the JNI inside of node possibility you face a similar issue, Java
blocks and blocks and blocks, virtually every call would need to
either spawn a thread or the JNI would have its own eventqueue. I
currently have an example of getting the JNI onto node in github, but
the proper way to do calls would have to be async and for small
operations would be prohibitively costly.

for now, I would recommend using separate processes for what they are
good at until either of those sides can be resolved.

On Sep 18, 9:02 am, Dean Landolt <d...@deanlandolt.com> wrote:

Marco Rogers

unread,
Sep 18, 2010, 11:04:57 AM9/18/10
to nodejs
Yeah, basically Netty/jvm have the "EventMachine problem".
EventMachine is great, but the ruby language already comes with too
much blocking baggage. So to use the wealth of libraries you have to
give up a lot of the async benefit or start spawning threads
everywhere and worrying about locking. Which... also kills much of
the async benefit. (I'm sure someone will school me here, I may be way
off).

One of the core things that's really exciting to me about node is that
by virtue of choosing a language without this baggage, we can start to
revamp libraries. Blocking routines are being rewritten to be async
and evented. This a good thing. It's a long road and you're going to
be missing some functionality while the new versions are being battle
tested. But in the end you end up with a system that can do all the
same stuff, but much more efficiently.

:Marco

Dean Landolt

unread,
Sep 18, 2010, 11:33:42 AM9/18/10
to nod...@googlegroups.com
On Sat, Sep 18, 2010 at 10:42 AM, Bradley Meck <bradle...@gmail.com> wrote:
i agree having nodes api moved to rhino could be interesting, however,
most of the tools in java just dont sync with node. Java is based
largely on the idea that threaded systems are great (look at the
synchronized keyword). It's APIs are blocking except NIO (which has
virtually no optimization). You could give the node implementation on
it a single thread per async call, but then its just doing what Java
would do to begin with.

Netty's all about async, already built on NIO and IIUC fairly well optimized. That said (and as Marco pointed out) I get that you still have "the EventMachine problem" -- you lose access to a huge portion of the ecosystem -- if that's the reason you chose the jvm in the first place you're SOL.

There are other reasons you may want (or need) the jvm though. I was just pointing out that the masochism of java development is not necessarily required to use netty.

Reply all
Reply to author
Forward
0 new messages