Supervisor hierarchy question
Eric Merritt
cyberlync@REDACTED
Sat Jan 15 05:09:46 CET 2005
Guys,
I am finishing up an implementation of a client for postgresql.
Overall was pretty simple, the protocol is well documented and Erlang
is geared for this stuff. However, I do have a couple of questions
about my supervisor hierarchy.
Here is how things are set up.
A Supervisor that watchs the top level system process.
The system process implements gen_server and accepts requests for new
connection_pools and requests for the Pid of an existing connection
pool. When the system process launches a new pool it uses the
start_child function for its parent supervisor. So the hierarchy
looks like
Supervisor
/ | \
System CP1 CP2
The thing I don't like about this is that when the system process gets
a request for a pid it calls which_system on its supervisor and
scrolls through the list to find the connection_pool by name. This
kind of parent pointer 'smells' bad.
Now when the connection_pool gets a request for a connection it needs
return the PID of an active connection. If non are available it needs
to return an error or start a new one depending on its setup.
This is my question. When the connection_pools starts up its initial
set of connections where should it put them, under another supervisor?
If so what should supervise the supervisor? Should it look like this?
Supervisor
/ | \ \ \
System CP1 CP2 CP1-Conn-Sup CP2-Conn-Sup
Or should it just create a supervisor without an explicit parent supervisor.
I hope this is intelligible to you all. Any suggestions are appreciated.
--
I'm a programmer, I don't have to spell correctly; I just have to
spell consistently
More information about the erlang-questions
mailing list