Maximum connected users to Open ETP Server is limited to 99
Problem description:
Current architecture of Open ETP server has limit of 99 opened user sessions, this is related to maximum connections to PostgreSQL (100 by default). Of course the number of PostgreSQL connections can be increased, but this may require more resources from DB host machine (why it's bad idea).
In the current implementation, new user session opens new DB connection, when limit is exceed, server returns a generic error. This can be a real bottleneck, because ETP protocol which is based on WebSockets, assumes that a connection established with a user could live a long time.
Update 5/02/2023: Currently just one client can make server unavailable if he will make requests to 99 different dataspaces in the same session (fixed in !140 (merged) ).
Suggested solution:
The most commonly used approach is to use shared DB connections, where each particular user request allocates DB connection from pool and releases it on finish. The schema below shows the current and proposed solution:
Additional benefit of suggested approach is better performance for new user requests, where reused DB connection has already prepared queries (statements).