hanging on to open udp sockets.

Eric Merritt <>
Sat Nov 12 02:34:12 CET 2005


 Hello All,

  I have this requirement for a little app that sends udp datagrams to
another host. For the moment I just want to concentrate on the
sending. So I am assuming that I need to hold on to the open udp
socket after creation and reuse it as work comes in. This presupposes
a modest pool of worker processes. This in turn presupposes a
supervisor that watches this pool of processes and balances load
across them.

  This is all pretty easy to do in erlang, no problem. However, is it
worth it? I wonder of managing the pool of processors and load
balancing messages across them is going to be more expensive then just
opening a udp connection when I need to send something. I don't use
udp very often so advice is welcome. Just note that there is a valid
use case for using udp instead of tcp in this instance. Here losing
data doesn't hurt the overall system nor is there any need for an ack.
So tcp is not indicated.

  Ok if I do need a pool of processors with there own connection I
suspect the way to go is for a registered/named gen server to spawn a
pool at a processes and handle routing messages, exit messages from
pool members, etc. The pool members should then notify the gen server
when they are done with whatever work they have been assigned.


Thanks for your time.



More information about the erlang-questions mailing list