jira-importer opened a new issue, #1427: URL: https://github.com/apache/httpcomponents-core/issues/1427
**[Sergiu Prodan](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=sergiuprodan)** opened **[HTTPCORE-433](https://issues.apache.org/jira/browse/HTTPCORE-433?redirect=false)** and commented This issue was observed after upgrading to httpclient v4.5.2 and httpcore v4.4.4. When configuring the PoolingHttpClientConnectionManager, I have set validateAfterInactivity to 1ms as this is the only way of maintaining the old behaviour, i.e. checking every connection if is stale before using it. I have observed a performance degradation under high load when the httpclient is shared between multiple threads. This httpclient is used only for one route. After taking a thread dump, one thing that got my attention was several threads waiting for same ReentrantLock instance while trying to AbstractConnPool#getPoolEntryBlocking/AbstractConnPool#release. The ReentrantLock instance in question was owned by another thread performing CPool#validate. It seems to me that performing this stale check inside the region protected by this lock is unnecessary and also induces a big performance hit when using the httpclient from multiple threads. I've atached a thread dump of a test application that reproduces this behaviour. ReentrantLock in question in this thread dump is 0x0000000706e8b9a8 and is owned by Thread-4. --- **Affects:** 4.4.4 **Attachments:** - [httpclient_thread_dump](https://issues.apache.org/jira/secure/attachment/12829203/httpclient_thread_dump) (_31.77 kB_) - [threads_when_inactivity_set_to_1.png](https://issues.apache.org/jira/secure/attachment/12829207/threads_when_inactivity_set_to_1.png) (_48.42 kB_) - [threads_when_inactivity_set_to_2000.png](https://issues.apache.org/jira/secure/attachment/12829208/threads_when_inactivity_set_to_2000.png) (_47.09 kB_) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
