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