TCP connections much higher than GatewayModeMaxConnectionLimit
See original GitHub issueDescribe the bug
In Gateway mode with GatewayModeMaxConnectionLimit
around 500, TCP connections used by our Azure App service towards our Cosmos DB goes far beyond the 500 limit.
To Reproduce
- We got a single CosmosClient built like that (
new CosmosClientBuilder(endpoint, authKey).WithConnectionModeGateway(500).Build()
) - We use a single Container, hence a single database and collection. Code looks like that
client.GetContainer(config.OurDatabase, config.OurDataCollection)
- From there, we use the container in 2 ways. Either we read from with
container.GetItemQueryStreamIterator
or write to withawait container.UpsertItemStreamAsync
Our app is living alone on an app service plan (“server”)
Expected behavior We expect to have at most 500 TCP connections towards our Cosmos DB but under some load (5K Cosmos request under 1 minute) we get to the app service’s TCP connections limit (in our case, ~4K)
Actual behavior We got many SocketExceptions resulting in faulted Cosmos Queries.
One of our TCP peak problems:
Environment summary SDK Version: 3.5.0 OS Version: Windows App service P2v2
Thanks a lot Phil
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:20 (9 by maintainers)
Top Results From Across the Web
How do high traffic sites service more than 65535 TCP ...
But a server can (theoretically) serve 65535 simultaneous connections per client. So in practice the server is only limited by how much CPU ......
Read more >EC2 Tuning for +1M TCP Connections using Linux
However it is possible to achieve greater than +10 million connections by moving TCP into User Space using Raw Sockets. TCP / IP...
Read more >Limiting maximum number of concurrent outgoing TCP/HTTP ...
The system 'outgoing' ports is significantly higher than 65k, you generally should not worry on outgoing connections.
Read more >Is there a Limit to Number of Connections a Backend can ...
Someone asked me a question and I felt its interesting to make a video about, is there a limit to the maximum number...
Read more >Unable to open more than ~50k connections between two ...
I have two linux instances in my custom VPC, and I'm trying to test to see how many concurrent TCP connections I can...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This PR https://github.com/Azure/azure-cosmos-dotnet-v3/pull/1548 needs to go in first. Then this fix can be added.
@jesuissur thanks for investigating. I’ll try to get a PR out with a fix before the next release.