Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 08E80200B87 for ; Mon, 19 Sep 2016 16:17:23 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 078A0160ABC; Mon, 19 Sep 2016 14:17:23 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 46A8B160ACC for ; Mon, 19 Sep 2016 16:17:22 +0200 (CEST) Received: (qmail 68764 invoked by uid 500); 19 Sep 2016 14:17:21 -0000 Mailing-List: contact dev-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list dev@hc.apache.org Received: (qmail 68642 invoked by uid 99); 19 Sep 2016 14:17:21 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Sep 2016 14:17:21 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id D1CE62C1B7F for ; Mon, 19 Sep 2016 14:17:20 +0000 (UTC) Date: Mon, 19 Sep 2016 14:17:20 +0000 (UTC) From: "Sergiu Prodan (JIRA)" To: dev@hc.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (HTTPCORE-433) Setting validateAfterInactivity to 1ms increases lock contention in AbstractConnPool MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 19 Sep 2016 14:17:23 -0000 Sergiu Prodan created HTTPCORE-433: -------------------------------------- Summary: Setting validateAfterInactivity to 1ms increases lock contention in AbstractConnPool Key: HTTPCORE-433 URL: https://issues.apache.org/jira/browse/HTTPCORE-433 Project: HttpComponents HttpCore Issue Type: Bug Components: HttpCore Affects Versions: 4.4.4 Reporter: Sergiu Prodan 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. 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 -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org For additional commands, e-mail: dev-help@hc.apache.org