-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
I was wondering if it's possible to make the client object a Disposable since there's no way to release the resources it uses including open connections. I was trying to find a way to use it under high loads, and in my tests in certain cases I hit socket exhaustion with this error:
Only one usage of each socket address (protocol/network address/port) is normally permitted.
I think having a disposable client allows me to develop a safe and performant client factory to avoid the socket exhaustion problem.
Is this possible?
I ran some tests:
- 13 instances of the client with 1000 requests from each one results in the error (Avg of 13-14k requests)
- if I create an instance per request, it is incredibly slow and has a lot of memory allocation but I can go up to 21000 requests instead of 13000
- I can use object pooling and it kind of works and extends this range, but I feel like it only delegates the port exhaustion issue to a further point in time and can still cause it
If not possible I would like to know if there's some best practices for using the client in an efficient way.
thanks!
Metadata
Metadata
Assignees
Labels
No labels