intermittent connection failures under high concurrency

Felduv Garnat 20 Reputation points
2026-10-02T06:49:14.85+00:00

Our applications are experiencing intermittent connection failures under high concurrency. Could you please advise how to troubleshoot the connection limit and identify whether Windows networking or system configuration is restricting the number of concurrent connections?

Windows for business | Windows Server | User experience | Other
0 comments No comments

2 answers

Sort by: Most helpful
  1. Harry Phan 33,400 Reputation points Independent Advisor
    2026-10-02T07:22:16.5833333+00:00

    Hello,

    Intermittent failures under high concurrency often point to ephemeral port exhaustion or TCP/IP resource limits. Windows assigns ephemeral ports from a range defined in HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\MaxUserPort. If the range is too narrow or sockets linger in TIME_WAIT, new connections fail. You can confirm this by running netstat -ano during peak load and checking how many connections are stuck in TIME_WAIT. Performance Monitor counters like TCPv4\Connections Reset and TCPv4\Connections Established will also show whether resets spike under load. Event Viewer entries such as Event ID 4227 or 4231 are direct indicators of resource exhaustion. If confirmed, increase MaxUserPort to 65534 and reduce TcpTimedWaitDelay to 30 seconds in the same registry path. Also check WinHTTP’s MaxConnectionsPerServer under HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp, as a low value can cap concurrency. IIS or application-level pooling misconfigurations can further amplify these limits, so review those settings as well.

    I hope you've found something useful here. If it helps you get more insight into the issue, it's appreciated to accept the answer. Should you have more questions, feel free to leave a message. Have a nice day!

    HP.

    Was this answer helpful?

    0 comments No comments

  2. AI answer

    2026-10-02T06:49:42.4333333+00:00

    Use this troubleshooting path to determine whether the failures are caused by outbound port exhaustion, connection limits, or application connection behavior:

    1. Check whether the symptom matches outbound connection exhaustion. Common signs include intermittent time-outs, slow responses, intermittent 5xx or Bad Gateway errors, and inability to connect to external endpoints. These are documented symptoms when outbound connection limits or SNAT ports are exhausted in Azure App Service.
    2. Determine whether the issue is on Windows outbound ports. On current supported Windows versions, the default dynamic client port range is 49152 through 65535, which provides about 16,384 ephemeral ports for outbound connections. Windows normally holds closed ports for four minutes before reusing them. Under high connection churn, this can cause intermittent connection timeouts.
    3. Identify the worst offenders by collecting port ownership. Use the ports.txt approach described in the SQL Server connectivity troubleshooting guidance to list inbound and outbound ports, port numbers, process IDs, and owning applications. Review that list to find which process is consuming the most outbound ports and whether the host is approaching the port limit.
    4. Check whether the application is rapidly opening new outbound connections instead of reusing them. The guidance explicitly states that exhausting outbound ports is often caused by non-pooled connections or non-pooled background connections. The preferred fix is to change the application to use connection pooling.
    5. If the workload is hosted on Azure App Service, check for SNAT exhaustion. Each App Service instance is initially given 128 SNAT ports. This limit especially affects repeated outbound calls to the same destination address and port. Closed connections are reclaimed only after four minutes. If the app rapidly opens new connections to the same endpoint, intermittent outbound connectivity issues can occur.
    6. If immediate application changes are not possible, adjust Windows port reuse settings carefully. As a temporary mitigation on the host machine, TcpTimedWaitDelay can be reduced from 240 seconds to as low as 30 seconds so outbound ports are recycled faster. The dynamic client port range can also be widened by using netsh int ipv4 set dynamicport tcp or the IPv6 equivalent. Risk: these are system-level networking changes and should be tested carefully because they affect host networking behavior. They do not fix inefficient connection usage in the application.
    7. Consider whether antivirus or network filter drivers are interfering. If packet traces show packets arriving but no ACK being sent back, the guidance indicates antivirus or another network filter driver may be dropping or delaying packets long enough to cause failures.
    8. For application design, reduce unnecessary simultaneous connections. Windows Winsock guidance recommends that concurrent connections generally should not exceed two except for special-purpose applications, with a rule of up to four short-lived connections or two persistent connections per destination. Reusing persistent connections is more efficient than creating many short-lived ones.
    9. If testing on IIS running on a Windows client OS, verify platform request restrictions. IIS on Windows client OS has request concurrency limits and can quickly exceed them, causing slowdowns and in some cases HTTP 403.9 or queued requests. Windows Server OS does not have these IIS request restrictions.

    A practical decision tree:

    • If failures happen during outbound bursts and recover after a few minutes, suspect ephemeral port exhaustion or App Service SNAT exhaustion.
    • If one process owns most outbound ports, focus on that application's connection pooling and reuse.
    • If traces show missing ACKs, inspect antivirus or network filter drivers.
    • If the issue is specific to IIS on Windows client OS, verify request concurrency limits.

    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.