Take a look at the Erlang connection pool recently and think ranch is good.
There's someone on GitHub who wrote a ranch code reading, which you can look at and link to here.
1. Ranch can listen to multiple ports at the same time, the connection information of each port can be configured separately.
The listener information for each port is logged through the ranch_server process, and then the information can be read from the ETS table. Because configuration information is seldom modified, more information is obtained. Such a read-write separation is more convenient and concurrent.
2. The maximum number of connections can be set per connection, controlled by the Ranch_conns_sup.erl module.
Each connection, the connection pool notifies the ranch_conns_sup process of the number of process updates, and then decides whether to make the next socket connection, depending on the current connection situation.
Ranch_server Records and manages all port connection information, and the Ranch_conns_sup process records and manages connection pooling information in separate ports, all of which are one-to-many relationships.
Ranch Code Brief