Saturday, September 11, 2010

announcing node.ocaml

I've been spending my weekends building node.ocaml as a both a learning exercise in doing asynchronous programming in C and OCaml using libevent and as a way to get back into OCaml programming. node.ocaml is open sourced under a BSD license.

While I have many crazy ideas I want to do with node.ocaml, I find myself pleased with what I have as it has become useful (for some of my current projects). Not only am I happy with it, but I'm going to go stone cold crazy and start pushing some of it to a production environment. So, its now game on to finding and stomping out bugs as well as define deployment procedures

Currently, there are two example servers.

There is an ultra simple key value pair storage server and a geo-tagged-document search server. The KVP pair storage is basically inspired by memcached except without expiration polices; while this would be nice to clone to memcached, it would clutter this baseline example. The geo server is useful as a way of providing local search and local analytics quickly; that is, its a quad tree server (which I hope is correct, but I will soon find out).

Performance out of the gate has been very good. I've just utilized libevent's built in http server and kept all the code asynchronous. I'm sure I need to optimize some buffer utilization, but I'm pleased with what I have and the interface that I'm using.

The unix guys were smart by thinking about data in terms of lines, and by thinking about lines it makes building/connecting this stuff fairly standardized. Combine this idea with JSON (minus white-space), and you can build some expressive data servers with a decent protocol.

Why I called it node.ocaml?

I love node.js. It makes building custom servers fun again. However, every-time I do anything in node.js, I feel like I'm going to regret it and pay some terrible performance tax in the future. I like to squeeze every last drop of power from my CPU, and this is part of my art. I love fast code.

My goal is to utilize OCaml to enable developing expressive custom servers that are blazin' fast.

I hope you follow node.ocaml on github, and I'll throw up a Google group for future announcements/collaboration.

2 comments:

  1. "It makes building custom servers fun again. However, every-time I do anything in node.js, I feel like I'm going to regret it and pay some terrible performance tax in the future."

    Question: did you mean to say OCaml in this sentence?

    ReplyDelete
  2. DT: heh, no. Ocaml is quite a bit more snappy than javascript implementations.

    ReplyDelete