Database connection management

Hello,

I’d like to better understand how the Pritunl service manages its connections to the database, particularly when using a MongoDB Atlas cluster.

The reason for my inquiry is that, according to the MongoDB monitoring dashboard, there are currently 49 active connections. However, we only have 6 VPN servers and 8 active users total—not per server. These 8 users are actually IoT devices that interact with our system.

I’m aware that MongoDB reserves around 10 connections for internal operations, but that still leaves 39 connections unaccounted for. Could you provide any insight into how Pritunl handles its database connections and what connection load we should expect, especially if we scale up to, for example, 20 VPN servers and 200 users?

For context, I’ve built an API server that registers these IoT devices as users. Every minute, each device sends a request to this API—first to register itself with the organization, and then to verify that the user still exists. (I understand the second step is redundant, but it’s part of the fixed device registration flow.)

P.S. The database access is strictly limited, so only the Pritunl service is able to connect to it.

Thank you in advance for your help.

The pyMongo default pool size limit is 100. It will continue to open up to 100 connections and leave them some of them open. I’m not sure what the internal logic is for determining how many to leave open but the limit can be reduced by adding "mongodb_max_pool_size": 100, to the /etc/pritunl.conf file.