I am doing performance testing of my Azure Web API that receives file attachments from the client and then uploads them to the Data Lake Store. My performance test is currently running for 6 minutes with a load of 250 users making 40 requests/sec.
The file uploads are successful until around 4minutes while the requests are under 4000, once the requests exceeds 4000 the file upload starts failing with the error of Port Exhaustion.
After some research I found out that there are around 4K ports available for communication and once the client sends the FIN packet, those ports go into a TcpTimedWaitDelay which by default is 4minutes(240seconds).
The solutions I found after initial research includes
1- Minimizing the TIME_WAIT of the ports by changing the registry.
My scenario: I'm using a Web API and I do not have access to the VM.
2- Increasing the ports to 65K by changing registry.
My scenario: I'm using a Web API and I do not have access to the VM.
3- Disposing the http client that is being used to make the requests.
My scenario: I do not have access to the client directly as I am using Azure .NET SDK's DataLakeStoreFileSystemManagementClient to upload the files.
I get the error after around 4K+ requests have been made. For file upload I use
DataLakeStoreFileSystemManagementClient.FileSystem.Create(_dlAccountName, filePath, filestream, true)
Can someone please help fix this port exhaustion issue?