Azure App Service and Azure SQL Database: Connection Pool Scaling vs SNAT Port Exhaustion
23.7K reputation · 05 Jun 2023, 15:19 UTC
Concurrency Latency in Outbound Connections
When scaling Azure App Service applications that communicate with Azure SQL Database, high volumes of concurrent requests can introduce intermittent latency. This behavior often manifests during rapid traffic spikes rather than steady-state loads, complicating the distinction between application-level bottlenecks and infrastructure limits.
Resource Constraints and Pooling
The interaction between the .NET connection pool and the App Service outbound IP infrastructure creates a potential conflict. While increasing the Max Pool Size can reduce request queuing latency, it increases the number of concurrent TCP connections maintained by the instance. This raises the risk of SNAT (Source Network Address Translation) port exhaustion on the App Service outbound IP, which can lead to connection timeouts and increased latency for new requests.
Furthermore, the Azure SQL Database gateway may exhibit increased latency when processing a high volume of simultaneous new connection establishments compared to the reuse of existing pooled connections.
Technical Uncertainty
There is a critical trade-off between optimizing for database resource contention and avoiding outbound port exhaustion. It is unclear how to balance the Max Pool Size against the available SNAT port quota to ensure stability during burst concurrency without triggering gateway-level latency.
- How does the Azure App Service environment manage the lifecycle of idle pooled connections to prevent SNAT port leakage during concurrent spikes?
- What is the recommended strategy for aligning connection pool limits with the SNAT port capacity of a specific App Service plan tier?
0 answers
A thoughtful contribution can make all the difference. Be the first to share one.
0 question comments
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.