Tercio
For the last couple of weeks, I have been working on a little side project called Tercio. Its meant to be a web app server for Erlang. Erlang, however, presents a few twists that a web app system should take into account. The two most important 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. 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 bridge would allow you to send messages from the client to the server and receive messages back. This bridging 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.
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. I based this system on the trap exit howto “A fast web server demonstrating some undocumented Erlang features”. It’s called ‘carre’ and built into the tercio system. It is not the only way to serve tercio apps, but it is by far the easiest. I made the configuration and briding systems with 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 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 that is complete, I will be able to start building something more compelling. ⤧ Next post Into the Client ⤧ Previous post Tercio Serving Requests