connection pooling with sockets

Pablo Platt pablo.platt@REDACTED
Thu Apr 8 15:57:49 CEST 2010


Hi,

What is the correct way to build a TCP socket connection pool?
Each process will open a TCP socket.

1. N processes each handle a single request.
A gen_server will receive requests and if there is no connection free will queue it.

2. N processes each can send several requests over the socket at the same time.
Requests have a unique id so the process can reply to the client, if needed when it decode the response.
A gen_server will pass requests with round robin.

Is it better to use simple processes linked to the gen_server so they will be light weight and faster?
In case a process die the gen_server manually restart it.
Another option is to use a gen_server per connection process and a supervisor to restart it.

Thanks


      


More information about the erlang-questions mailing list