Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Why You Should Pay Attention to Node.Js (redmonk.com)
92 points by thekguy on May 13, 2010 | hide | past | favorite | 28 comments


Something I feel that is significant and only touched on tangentially is that there are a _ton_ of javascript programmers out there. If Node.js or a project like it becomes successful it could provide a very easy mechanism for all the javascript programmers to do server side software as well. It's something that could significantly alter the web programming ecosystem.


It seems like knowing the syntax of whatever language you're doing server programming is not the most important aspect of server side development. It's a really different skill set than what javascript has been used for up to now.


To a degree perhaps. However, Node.js has a programming style that's highly reminiscent of code you would see in a browser. For instance, responding to a conenct event on a socket

  socket.addListener("connect", function () {
    socket.write("hello\r\n");
  });
is really not that different from responding to a click event on an element in jQuery.

  $("#my-element").click(function() {
    alert('Element Clicked!');
  });
I'm not saying that it will instantly make everyone a server side programmer, but it definitely makes the barrier to entry quite a bit lower.


I don't see how that is much different, syntactically, from:

  public void service(ServletRequest req, ServletResponse res) throws IOException {
    res.getWriter().println("hello");
  }
Yes, JavaScript is dynamically typed so you don't have to type the types.


It's not about knowing the syntax. It's about expertise and fluency. If you're fluent in Javascript, why should you have to learn another language to program the server in? If anything this should have happened about a decade ago.

(Which it sort of did; I used to use JScript in ASP, but it's not quite the same.)

(Yes, I am the person who frequently compares Node.js to Erlang, unfavorably. But my objection is to the hype that Node.js is a unique and beautiful snowflake, rather than a retread of ideas done endlessly in other languages. I still think that on the whole it's a good idea, even if I don't think it can actually live entirely up to the hype, it can still do good things.)


Node.js isn't as "good" as Erlang. Yet. But what we see over and over is some solution that is good enough and easy to get started with that gets popular, and then gets the support ($$$) to improve.


What we also see over and over, once you learn to how to look for it, is that pouring money into something without the fundamentals to support the tech you're trying to build doesn't work. You can't exceed your primitives, and matching Erlang's primitives turns out to be pretty hard. Any attempt to jam Erlang's primitives into Javascript will make it not Javascript anymore, but some derived language that merely resembles Javascript.

Node.js will get better, but it will get spanked by Erlang at high loads and with lots of processes, and while there isn't nothing that Node.js can do about it, there's a limit to what they can do and still be JS.

(Interestingly, this is not necessarily true in general. It is particularly true here because Javascript is the colloquial term for ECMAScript, which is a standard. To get the requisite primitives in there would require changes that violate the standard, such as the execution environments and the way references are treated. A language that isn't standardized could change and still claim to just be the next version.)


Actually, what you say touches on one of the reasons why Node is exciting for js coders.

Working with Node's callbacks for I/O feels a lot like working with jQuery's XHR/animation callbacks. It's a consistent flow that will feel familiar for a lot of js coders immediately. Speaking from personal experience, it really does help the brain keep moving.

Many javascript programmers are more than familiar with server-side development, they just haven't necessarily had a super productive environment within which to flex their skills, but that may be changing.


Agreed. Whatever server-side language you're using, you're likely using javascript too.

I think CommonJS is the more important project to consider here.


They are missing the JS-on-the-server boat for being too focused on pleasing asynchronous-rocket-scientists while the web is simply asking for plain JS.

All the web world need is a way to print('<h1>Hello world</h1>') easily, no need to create servers and listen to ports to just spit some html, and there is where node fails.

V8CGI is an interesting option but lacks penetration.

Google could hit a home run if they provide NATIVE js on app engine (not rhino on top of Java)


"Google could hit a home run if they provide NATIVE js on app engine (not rhino on top of Java)"

Looks like Heroku is heading for the home run instead.


So you want it to run per-request like PHP?


Personally, I don't care how it runs as long as I can code JS on the server as easy as php.

I'll be more explicit, this is all I want:

  - open editor and type:
  - response.write("<h1>Hello world!</h1>")
  - save it as hello.js and run it
See? nothing else.

Right now V8CGI is the closest to my dream I've found.


I don't see why someone couldn't create that as a layer on top of what Node.js already does since it's just a special case.


Exactly my point.

Node is cool and stuff, but lacking the layer of simplicity Joe scripter needs to write his family album or personal shop.

Abstract everything from me and just let me write html (without having to use any framework)

And no, it is not a special case, it is what 99% of web scripters today need. The other one percent are those who lurk around node.js in google groups, the brains behind the monster, the ones who want to compete with nginx and apache, those building frameworks and utilities, not the ones who write casual stuff who take a look and decide to go shopping while something easier comes along, count me among them.


This post alludes to performance faster than nginx. Anybody have any real-world experience comparing the two? I'd love to hear about it if so...


I'm also interested since I've never seen it benched faster than nginx. It's usually about 80% of the speed on echo benches, but there's an ongoing email thread about response latency causing major slowdowns, so perf improvements are ongoing.

It's still far faster than anything else I've used as far as response time. The other dynamic languages don't run as fast and it lacks the layers of filtering/abstraction that bog down the compiled languges.


See slides 4-6 in Ryan's presentation (http://nodejs.org/cinco_de_node.pdf). He caveated the comparison heavily, and also took pains to note the vast differential in memory consumption.


Is this a replacement for stuff like Python's eventlet, etc. ? I mean, if I am not building a web-app (but a network app nevertheless), does it still make sense to use Node.js ?

For example, someone wrote the same example in eventlet, gevent, node.js, eventmachine, tornado and twisted. http://gist.github.com/376416

it's pretty obvious how to use gevent from your python code, how does one use node.js (without resorting to web frameworks, like Django etc.)



Could someone please hurry up and write a well-supported, popular lisp that compiles to javascript and runs on V8 (it could be friends with clojure)? I hate hate hate javascript's syntax and object model, but evented I/O in a lisp would be heavenly to work with.


Personally, I think CoffeeScript is close to the perfect syntax for a language.


"Implicit in node is a fundamental rejection of traditional I/O. It’s pushing an asynchronous agenda with its event loops, based on the assumption that concurrency cannot be achieved with a thread per connection" This is actually very very wrong event based using kqueue/epool in 'modern operating systems' (read:monolithic/hybrid/posix) takes ~ 8 system calls while a threaded approach takes about 2/3 of that to do the same.


Cool writeup. I am enthusiastic about node.js and I have Heroku node.js beta access - now all I need is more free time.

Javascript and node.js have a nice development story and I am trying to spin up a bit on Emacs support for Javascript.


mod_v8 for nginx would be much better idea. Or, state it differently, v8 + nginx portable runtime.

It is better to put together what is great, than reinvent the wheel.


The author of nginx, Igor Sysoev, actually investigated on this and decided creating contexts in V8 is too slow (2ms) for being used in such a manner:

http://translate.google.ru/translate?js=y&prev=_t&hl...


V8 is open source, and I think they will be happy to incorporate some performance enhancement patches. =)


I've tried mod_v8 ... was harder to install, kept choking, and didn't seem to be a very active project. node.js always just works and seems to be under quality rapid development.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: