once bitten

words and things from Edd Dumbill 
« Back to blog

A JavaScripter writes on why Clojure has the edge on Node.js

I'm a professional JavaScripter so you shouldn't read this as Us vs. Them. But if you're interested in a really high performance evented webserver that has the same delicious lack of ceremony of Node.js, I recommend playing around with Clojure and aleph.

I hope nobody paints this as too much of a religious war. As far as I'm concerned, Node.js and Clojure/aleph have a lot in common, and are exposing developers to a more efficient way of writing applications. (To be truly efficient in writing JavaScript, your keyboard needs a }); key of course.)

I really need a spare hacking weekend to get on top of this. I've been looking for the right way in to Clojure web applications, and aleph is very intriguing.

For reference, here's Hello World in Clojure/aleph

(use 'aleph)
        
(defn hello-world [request]
  (respond! request
    {:status 200
     :headers {"Content-Type" "text/html"}
     :body "Hello World!"}))

(run-aleph hello-world {:port 8080})

Comments (2)

Jul 08, 2010
Michael Payne said...
I work in financial services where huge volumes (messages per second) combined with demand for extremely low latency combined with "microburst" scenarios create a challenging environment. Java and the JVM in this space repeatedly fail. The terms "garbage collection" and / or "heap memory" always precede the explanation for why the applications fail intra-day. I haven't tested node.js in this environment and don't know if it would succeed, however I can guarantee you that anything dependent on the JVM does and will fail.
Jul 09, 2010
erikcorry said...
If GC is your problem then node (ie V8) won't be any better. On the contrary with the current GC it is almost certainly worse than Java. Real time together with GC is a problem that is completely solved in academia and not quite so solved in the real world.

Leave a comment...