Episcina - A Simple Erlang Connection Pool

Episcina is designed as a pool for resources. Generally those resources are expected to be connections to some type of external thing like a sql system. However, there is nothing sql specific about episcina. You may generally consider it a small very focused pool implementation that does not try to take ownership of your work.

How It Works

Episcina will create any pools defined in the episcina’s ‘pools’ environment parameter, which is a proplist that tells episcina how to connect. There are several parameters that are required.

Episcina also has two optional parameters:

sys.config file example:

{episcina, [{max_restarts, 2000},
            {max_seconds_between_restarts, 7200},
            {pools, [{db1,
                          [{size, 10},
                           {timeout, 10000},
                           {connect_provider, {pgsql, connect,
                                               ["localhost",
                                                5432,
                                                "my supersecret pass",
                                                "postgresql",
                                                [{database, "foobar"}]]}},
                           {close_provider, {pgsql, close, []}}]}]}]}.

Pool Usage

{ok, C} = episcina:get_connection(Pool, Timeout).
ok = episcina:return_connection(Pool, Connection).

Details