Wednesday, December 27, 2006

Tercio Serving Requests

Tercio is now providing bridge services and handling requests. This is great. I still have to write the narrativejs converter and the client libraries, but the fact that bridging is happening is just awesome.


For the last couple of weeks I have been working on a little side project called Tercio. Its meant to be a webapp server for Erlang. Erlang, however, presents a few twists that a web app system should take into account. The two major aspects that need to be integrated are concurrency and OTP. With a bit of thought you can create a system that makes use of concurrency and allows for the use of OTP. However, I didn't want to do that. I want to create a system that is intrinsically entwined with concurrency and requires OTP for its best use. This takes a bit more thought. In the end though I came up with what I think is a good approach. That is to create a 'safe' bridge into an OTP system from javascript. This would allow to send messages from the client into the server and receive messages back. This isn't a new idea. Guillaume Germain created something similar in Termite. However, I don't think anyone has made it simple, performant and scalable. Which is what I am trying to do. Fortunately I am pretty far along.

I have written a very usable configuration system called tconfig. For configuring tercio. I have also built in a pretty basic but working http server for use during development. This system is based off of the trap exit howto "A fast web server demonstrating some undocumented Erlang features". It's called 'carre' and built into the tercio system. Its not the only way to serve tercio apps but its by far the easiest. The configuration and briding systems are built of a custom, fast implementation of a json parser thats just a bit more lenient on input then the currently available one. It also can't parse chunked data, but there is always a trade off.

To make message passing between the client and server just a bit more interesting I am integrating the really ingenious narrativejs into the system. Its written in javascript, but through the power of gcj and rhino I have a native executable that erlang can make use of just fine.

I am just finishing up the erlang/javascript bridge parts of tercio. Once thats complete I will be able to start building up some really interesting stuff.