[erlang-questions] p2p ?

pierantonio redaelli windrunner1977@REDACTED
Sun Feb 4 13:41:41 CET 2007


hi, i'm fascinated by Erlang.
in theory Erlang seems perfect to do any sort of
network-related or distributed application,
in practice however it seems that everything is built
on top of Erlang process model,
including Ditribueted Erlang and OTP assumes that you
need to manage a small number of trusted nodes 
on a trusted network with good latency properties
(like a dedicated LAN).
now probably you tell me this is of course this is the
case if you have to develop a switch or other telco
applications
but this is does not appear to be the only type of
situation where the erlang process model is appealing
for network applications 

i think there another possible kinds of applications
where Erlang could extend find some audiance of
programmers is
distributed applications whith thousands of nodes and
significant latency (ie nodes on internet or worldwide
intranet).
obviously peer to peer applications are such a kind of
application. 
obviously today much of the P2P sw is written in java.

i would ask your comment on the way one would be able
to structure such an application using otp,
to see if the match between p2p and otp is really
possible, or, beyond any erlang buzzword, java is
really the way to go.
typically a p2p app (on a structured overlay) is a
layered software  where you have:
- some messaging layer that uses udp or tcp or http
etc to send/receive messages across nodes part of the
p2p overlay network
- a routing layer, the heart of the p2p overlay
network, that assign nodeID to a node, place the node
somewhere in a pseudo-metric space
  using NodeID as basis for the distance between any
two nodes and routes msgs across nodes based on that
distances
- basic services layer, like DHT (distributed
hashtables, offering get/put methods) or DOLR
(distributed object location and routing, 
which allow a level of indirection and save
information on where the entity you want to track down
is placed rather then saving the entity itself)
- the actual application (streaming, data sharing,
distibuted filesystems etc)

a very used idea in this software is to have one layer
call back into another
so that whenever the routing layer see a packet that
is for an application running on that node
it will call back the application which may to
application-specific changes to the packet contents
or even drop it or change its destination

some implementations (like Tapestry) uses a threadpool
for each layer, the threadpool shares a queue and
 the threads picks a msg (turned into an object) from
the queue and then process it and emits other msgs
(objects) 
that are places in the queues of other relevant
layers. that is using an event driven side but with
multiple processing stages.

but in erlang, what is the best way to implement this
kind of application structure in erlang ?

----------------
one way to do this would be to implement each layer as
an otp/application,
each of these otp/applications made of processes
sending erlang messages to other otp/applications
processes
apart the low level layer that would translate ip
messages to/from erlang messages.
an otp/app here would be similar to a component in 
component models on object oriented languages
is there a real component model that nicely fit into
erlang ? (not the elephant-like erlcom)
being able to have multiple instances of the same
component running in same node, and being able to
start/stop independently
being able to plumb/unplumb/change the flow of
messages among the components at runtime



cheers
piero


	

	
		
___________________________________ 
Vinci i biglietti per FIFA World Cup in Germania! 
yahoo.it/concorso_messenger



More information about the erlang-questions mailing list