Live data from Hacker News

Node.js has jumped the shark

unlimitednovelty.com

111–120 of 144 posts

Re: Node.js has jumped the shark

#111

Earlier quoted context omitted.

Didn't a similar event occurred a few years back (in HN as well)? Like around 2006-2007 with Ruby on Rails and the framework war? Big waves, big disagreements, flame-wars. Good prediction though Zed, I'm seeing ghetto Ruby (Rails related code) lately. Then it becomes the language wars between newer dynamic/functional languages. Now it becomes Node.js vs the rest of the world. Are we going to see crappy JavaScript cod…

crappy JavaScript code soon Is there any language in which a larger quantity of crappy code has already been written?

PHP runs a close second

Re: Node.js has jumped the shark

#112
Javascript integers can only reliably represent values up to 2^53, as they are implemented by 64-bit floats [1]. This means that fib(73) and below are correct, but fib(74) and onwards are almost certainly going to be wrong.

The one-millionth fibonacci number, fib(1000000), has 208988 digits when written as a decimal. It takes about a minute to compute fib(1000000) with python 2.6 and write it to file.

I am completely missing the point, but this does amuse me. Framework/language pissing match descends into performance benchmark battle where no-one cares about correctness?

1. http://www.jwz.org/blog/2010/10/every-day-i-learn-something-...

Re: Node.js has jumped the shark

#113
post #11

tl;dr; Don't use JavaScript for numerical computation. Don't block your IO loops for CPU intensive stuff. commentary: I've never met a Node hacker who would ever do any of those things. This post should be called "Straw man Node.js n00bs jump the shark." I've written web apps in a wide variety of dynamic languages, and you know what, I've never done anything CPU intensive in the request response loop, ever. This has…

My first reaction to this whole business: why would anyone run fibonacci on the same machine that is serving traffic?

For that matter, why would anyone write a CPU-intensive web application in anything but Native Client?

Re: Node.js has jumped the shark

#114
right tool for the right job. solving real problems is hard. unix, microsoft, beos python, java, brainfuck whatever. experts tend to be overspecialized and one dimensional. pundits have their own agenda. religion closes the mind's eye. forget about your preconceptions and embrace the world around you.

Re: Node.js has jumped the shark

#115
post #95

Earlier quoted context omitted.

That's a limitation of Rails, not Ruby. One could use Node.js in the same manner. Ruby has been doing async I/O in the form of EventMachine longer than Node.js has even existed.

NodeJS builds on some C async framework, so pretty much every language build on C could go the Node route - but it would be a lot of work. Personally I wish somebody would adapt it for Arc - or maybe not, so that if I ever apply to YC again I can do that for bonus points :-) EventMachine is OK, I suppose, but I have heard that it has some warts. Are there any good web frameworks that build on EventMachine? Though I s…

As of 1.3, Sinatra can do streaming using an evented webserver like Thin, which uses EventMachine. Goliath may also be worth checking out.

Re: Node.js has jumped the shark

#116
post #62

Earlier quoted context omitted.

Is """'"Talking about being down-voted before you voice an unpopular opinion" posts have jumped the shark' is dead!""" the "Considered Harmful"-Killer?

I think that's what happened. I guess my meta joke was misunderstood...

jokes are not appreciated

Re: Node.js has jumped the shark

#117
post #94
post #92

Earlier quoted context omitted.

I think in this case, we have yet to see the master put anyone on their ass. We have non-masters slinging insults and ineffective demonstrations. Don't typical Python and Ruby deployments also need 8 processes to utilize 8 cores? If I'm not mistaken, this is in fact how Heroku works.

As far as I'm aware, they do. GIL means that even using threads, they still need 8 processes to utilize 8 cores. There are more languages than those 3, though, and if those 3 are the languages that you're considering, evented vs blocking i/o is way beside the point when it comes to performance. A super-simple thread-per-connection program with blocking i/o calls from C or Java will demolish the most sophisticated eve…

Summary:

Ted: "Node is cancer, because it's not the one true tool that can do everything! It may be good at IO bound code but it's not so hot at CPU bound stuff".

Node hackers: "Yes it is the one true tool!".

Me: face-palm.

OK, Threads can be used to do anything, but they are hard, while async is pretty easy (unless you want to do CPU bound stuff). async sucks for CPU bound stuff, but that's not the problem it's trying to solve (and anyone who makes a big fuss over it from either side is a fool). But none of this really matters much, until you actually need to scale.

If you are doing something simple, C or Java will be best, simply because they are faster. But not everyone uses C or Java, and it's not like speed matters that much when your App server can scale trivially, your DB is the real bottleneck, and you only have 3 users (one of whom is your cat).

If you need a lot of connections, some of which block (due to a call to a web service like BrowserID or Facebook - and there's a lot more web sites that need to be optimized for web APIs calls rather than calculating Fourier transforms), you need lots of processes (which is too heavy in Python), lots of threads (and then you need thread-safety, which is a pain, and very easy to screw up), or something async like Twisted or Tornado. Given that Tornado is already really easy to use, and basic async stuff is fairly easy to get right, the choice is easy for me. (I don't know enough about JS, Node, and V8 to really comment on Node, but I'll just assume it's roughly equivalent).

The thing is, I just don't trust threads (at least, not if I'm doing the code). There's far too many ways you can have weird bugs that won't show up without a massive testing system, or when you get a non-trivial number of users. And you can't integrate existing libraries without jumping through a lot of hoops.

Using callbacks looks like "barely even moves" to me, while multi-threaded code looks like a "spinning roundhouse kick", but then, maybe I'm just not good at multi-threaded code.

I guess the most important things is that threads need to be 100% thread-safe. Async code only has the be "async-safe" in the bits that need to be async. It looks like this:

    @async
    def do_something():
        do_something_not_async_safe()
        do_something_async(callback=finish_up)

    def finish_up():
        do_something_else_not_async_safe()
Whereas threads look like this:

    def threaded_code():
        do_something_100_percent_thread_safe()
        do_more_thread_safe_stuff()

        # fail here when you have a few users
        do_something_that_uses_an_unsafe_library()

        more_thread_safe_stuff()
If you really need to do CPU bound stuff, async sucks. You can create a second server, which handles the CPU bound stuff (and call it using a web interface which is async safe). Or there are pretty easy ways to call a subprocess asynchronously. But arguing over the merits of async programming using Fibonacci sequences as a talking point is not even wrong. Anyone who brings it up is just showing themselves to be a complete tool. That might be what Ted was trying to do (as many of the Node responses have been unbelievably lame), but it doesn't prove anything except that the internet has trolls, and plenty of idiots who still take the bait.

Re: Node.js has jumped the shark

#118
post #61

I use node.js for long-lived connections (sending/receiving large amounts of data, or long-polling). This is a task to which it is ideally suited. Putting CPU-intensive operations inside a HTTP handler is something that is obviously not going to work in a single-process, single-threaded event-driven framework. Ted's complaining because node.js is unsuitable for something that it's not intended to be used for. Defendi…

> Defending CGI, in my opinion, also hurts his credibility. The "good old days" weren't so good. Spawning a new process for each request? Re-establishing database connections every time? That shit only worked because there were three people on the internet at the time.

Apparently the server behind SQLite.org and Fossil-scm.org, which gets 250M requests/day, spawns a new HTTP server for each request. There's no database, though.

http://www.mail-archive.com/fossil-users@lists.fossil-scm.or...

Re: Node.js has jumped the shark

#119

Earlier quoted context omitted.

__People are tribal. Some people are attracted to tribes, become attached without really knowing why, and start having the strong urge to fuck with the other tribes. Apparently this was good for the survival of the human race. Perhaps it's a bug now that we should consciously compensate for__ That this tribal behavior occurs among software engineering is a rather disappointing fact. Computers are pretty much the edge…

> That this tribal behavior occurs among software engineering > is a rather disappointing fact. It occurs amongst software engineering humans . All humans get this to some degree, it's basic ingroup/outgroup psychology. We're all humans here. It's nothing to do with "devoted to doing something positive" or "using our brains in more advanced ways." It's just the reality of being an evolved ape, and the lack or presenc…

Yes, thank you for writing this. We are all humans, even if we don't want to be, and we have to think about our actions in the context of our genetic programming. In the case of tribalism, even though it's a strong feeling, we have to ignore it because it doesn't get us anything in programming language debates.

The best attitude to have is one of acceptance and an open mind, because the right programming tool applied to the right problem can make solving that problem orders of magnitude less difficult. You can have programmer friends even if you don't unconditionally hate the enemy. In fact, it seems, most people don't care about who you don't hate.

Re: Node.js has jumped the shark

#120
post #96

Earlier quoted context omitted.

That thread pool isn't actually that simple. How many threads do you use? If you throw 1,000 threads at the problem with a 2MB stack each, that's 2GB of DRAM you've thrown away (instead of 20MB * ncores per Node process) -- DRAM that could be caching filesystem data, for example, which could have a huge impact on overall performance. With Node, the DRAM and CPU used scales with the number of cores and actual workload…

What a load of crap... you just wasted 2gb of address space not of DRAM... You'll "waste" exactly up to the amount of stack each thread uses, rounded up to PAGE_SIZE which is usually 4kb Let me guess, a nodejs fan?

You're right -- it's the touched pages that count. In many cases, that's a few MB per stack, which is what I said.
Post reply on HN