Hi, I need to do a choice between the various Ruby versions (1.8, 1.9, JRuby,
Rubinius...) and programming models (Reactor Model, Actor Model...) to build
a SIP (VoIP) server.
I've already started it and for now I've done a complete SIP grammar parser
using TreeTpo parser, but probably I must migrate to Ragel in order to get
more performance.
But what I really don't see clear is which paradigm and framework to use.
First of all let me explain something about SIP protocol (which I know very
well):
SIP is really complex. Its syntax looks like HTTP, but the protocol itself
includes various layers and becomes really more difficult than HTTP or SMTP.
Ufortunatelly I'll just implement TCP transport (SIP also allows UDP) but
anyway it's remain complex. There are various layers in SIP:
- Transport Layer: receives data (requests or responses) via any socket,
performs a basic parsing and sends the extracted data to the:
- Transaction Layer: Deals with retransmissions of the requests (if no
response was sent in a predefined interval), matches responses against their
requests, deal with CANCEL and ACK requests...
- Core Layer: Receives the request/response and handles it (a phone would
ring, a SIP proxy would route it, a SIP server would do "something" cool...).
There are a lot of timers in all the layers, so if a timer triggers then the
full call/dialog/transaction could be discarded (for example).
I've already read about various Ruby frameworks to achieve it:
- EventMachine: It's a Reactor Pattern implementation. It's based on events.
It could be a solution but it seems that the resulting code would be really a
pain to debug and not very "visible". I've got a recomendation from an
experimented Ruby coder for non using EventMachine in my project due to my
project complexity. It's actively mantained.
- Revactor: It's an Actor Model implementation. It offers a "like Ruby"
structured programming style. It allows "non-blocking" functions to behave
as "blocking" so the code is cleaner than using an event based style. It
seems to need Ruby 1.9 (I can wait) and AFAIK it not actively mantained.
- Omnibus and Dramatis: More Actor Model implementations in Ruby. Not sure if
they are mantained.
- Threads: I could built my application using Threads ("Green" threads in Ruby
or native threads if I choose JRuby). But I think the above solutions are
more ellegant and secure.
I must choose also the Ruby version:
- Ruby 1.8 and 1.9: It seems that the garbage collector is not good enough so
I'd would experiment memory issues.
- Rubinius: Better garbage collector, but it seems to be not enough mature for
now. It implements a built-in Actor Model. For now it cannot use native
threads.
- JRuby: Good garbage collector and mature, but not sure if it allows an Actor
Model using "something".
Well, as you see there are so many posibilities that is really difficult to do
the choice. Also note that, for now, I'm not an expertised programmer and
just know the above concepts because I've read about them in my search.
Could I receive a suggestion about it please? Thanks a lot.
···
--
Iñaki Baz Castillo