I have a service that is in Erlang. I am trying to connect to the service. However sometimes the connection creation gets timed out. I believe this might be because the service might be busy. This is periodic, on re-executing my program some time later it works well.
I am not sure how connection pool is defined in Erlang. I am trying to look into the same (unfortunately not much success so far) and would like to change the connection pool size. I am mainly looking into how connection management in done when executing jsonrpc commands. As per documentation only a new connection is created between client and server from any communication. I am trying to identify how to change upper limit for this if any.
Thank-you
I am not sure how connection pool is defined in Erlang.
There are some well-known connection pools in Erlang like ranch and swarm , which here you can find a summary of them.
I am trying to identify how to change upper limit for this if any.
For example in case of ranch you can set the connection pool size this way:
AcceptorNumbers = 100,
{ok, _} = ranch:start_listener(
ListenerRef,
AcceptorNumbers,
Transport, [{port, Port}],
Protocol, Options
).
Also you can create your own connection pool on top of OTP behaviours. For example, a pool of Generic Finite State Machines ( gen_fsm
) which holds client connections and are supervised can be as simple as this tutorial .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.