Concurrency with HttpClient
I’ve recently been heavily involved in moving towards a Service Oriented Architecture – and the most common form of Transport / Network Protocol used is of course, HTTP due to tooling and statelessness.
HttpClient is well known for being thread safe. Infact, it is very much encouraged to instantiate a HttpClient object and keep it in memory for as long as you need, this avoids the extra cost needed for reconstructing the object.
But, is it really that thread safe? Well, after some experiments with high volume of requests, it turns out – not completely / it depends.