Setting Client Connection Limits for Transaction Engines (TEs)
Each connected SQL client uses one file descriptor on the TE it is connected to.
The operating system imposes a limit on the maximum number of file descriptors a process can use at once; this determines the maximum number of concurrent SQL client connections that a TE can manage. Each TE reserves 250 file descriptors for overhead: connecting to Storage Managers (SMs), other TEs, NuoDB Admin Processes, and to NuoDB Admin clients. Any remaining file descriptors a TE is allowed to open can be used to support SQL client connections. The TE will print a message to the NuoDB Admin log file on startup showing the maximum number of SQL clients it can handle.
Once this maximum is reached, the TE will refuse new SQL client connections until some existing connections have closed.
If you want to ensure that the TE can support up to a certain number of SQL client connections, you can specify that when starting the TE using the max-client-connections
database option.
At startup the TE will ensure that it could support at least max-client-connections
SQL client connections; if operating system limits will not allow this then the TE will not start.
For more information on setting max-client-connections
, see Database Options.
SQL client connections are spread across all the TEs in the database. However, it is important to ensure that individual TEs have enough capacity so that, if one or more TEs are unavailable, the remaining TE(s) can still service enough SQL clients that your application’s availability is not impacted. |
There is no cost to allowing more file descriptors than are needed; they will not be assigned unless they are used.
Increasing the Operating System Limits
If the operating system file descriptor limits are too low for your needs you will need to increase them. For information on changing the maximum number of file descriptors allowed to a process, refer to the documentation for your operating system.
The limit must be changed before starting any NuoDB Admin (nuoadmin ) processes, so that TEs started by NuoDB Admin will inherit that new limit.
Modifying the limit after NuoDB Admin Processes start will have no effect.
|
To determine how many file descriptors are available on the host run the following command, where $PID
is the PID for a NuoDB Admin (or TE) process:
$ grep 'open files' /proc/$PID/limits
Max open files 1024 10240 files
-
The first number is the default number of file descriptors; if the TE is started without setting
max-client-connections
this (minus 250) will be the maximum number of SQL clients that can be supported.
In this example, TEs on this system can handle 774 (1024 - 250) simultaneous SQL client connections by default. -
The second number is the maximum possible file descriptors the operating system will allow this process to use, and so limits the maximum value that can be set via
max-client-connections
.
In this example, the highest value formax-client-connections
is 9990 (10240 - 250).