When running PgBouncer and PostgreSQL on Windows, especially under high-load scenarios with frequent connect/disconnect cycles, you may encounter exhaustion of available TCP ports. This is due to many connections ending up in the TIME_WAIT state, preventing immediate reuse of those ports and potentially leading to connection failures.
PgBouncer helps reduce the frequency of backend (PostgreSQL) connections, but VBO Controller Proxies opens and closes connections rapidly to PgBouncer itself, what can lead to the Windows ports exhaustion.
This situation can be resolved by reducing the port wait timeout, increasing the number of ephemeral ports, or combining them.
Create the following registry value to modify the length of time that a connection will stay in the TIME_WAIT state before being closed. The default is 240 seconds, which, with the default Dynamic Port Range, will lead to a limit of 68 connections per second. Changing this to 30 seconds will increase that to 546( # of ports / time out in seconds = connections per second || 16384/30= ~546) connections per second.
Key Location: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
Value Name: TcpTimedWaitDelay
Value Type: DWORD (32-Bit) Value
Value Data: 30
Note: Restart required to take effect.
PowerShell Command:
Before you change the Dynamic Port Range, please review all notes in the Considerations section above.
If issues persist after reducing the TCP Timed Wait Delay to 30 seconds. The following command will change the starting port of Dynamic Port Range from 49152 to 15000, resulting in just over triple the number of ports and raising the theoretical connections per second limit from 546( # of ports / time out in seconds = connections per second || 16384/30= ~546) to 1,684.
Note: Restart required to take effect.
If this KB article did not resolve your issue or you need further assistance with Veeam software, please create a Veeam Support Case.
To submit feedback regarding this article, please click this link: Send Article Feedback
To report a typo on this page, highlight the typo with your mouse and press CTRL + Enter.
This form is only for KB Feedback/Suggestions, if you need help with the software open a support case