Return-Path: X-Original-To: apmail-hc-httpclient-users-archive@www.apache.org Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D088610327 for ; Tue, 15 Oct 2013 09:08:14 +0000 (UTC) Received: (qmail 11026 invoked by uid 500); 15 Oct 2013 09:08:11 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 10820 invoked by uid 500); 15 Oct 2013 09:08:00 -0000 Mailing-List: contact httpclient-users-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-users@hc.apache.org Received: (qmail 10806 invoked by uid 99); 15 Oct 2013 09:07:57 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Oct 2013 09:07:57 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [217.150.250.48] (HELO kalnich.nine.ch) (217.150.250.48) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Oct 2013 09:07:49 +0000 Received: from [192.168.42.75] (unknown [213.55.184.142]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by kalnich.nine.ch (Postfix) with ESMTPSA id ECBF0B80016 for ; Tue, 15 Oct 2013 11:07:28 +0200 (CEST) Message-ID: <1381828047.13628.8.camel@ubuntu> Subject: Re: HttpClient IO hits the same core From: Oleg Kalnichevski To: HttpClient User Discussion Date: Tue, 15 Oct 2013 11:07:27 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.6.4-0ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On Mon, 2013-10-14 at 22:22 +0100, Ke Ren wrote: > Hi, > > We are sending massive http client requests on amazon ec2 instance with 8 > cores (m3.xlarge). We notice always one core is hammered the most (80%) but > others are just used around 30% to 40%. The httpclient we are using is > 4.2.5. I reproduced this issue with very simple code on ec2 4 core > instance. Basically I created one http client instance new > DefaultHttpClient(mgr, params); mgr is a PoolingClientConnectionManager. > This http client instance is shared by multiple threads. In this test, each > thread worker just gets the same 700k file from s3. The result is the same. > always just one core is hit heavily but very low usage on others. From > jprofiler profiling, it looks the most cpu usage is on IO read from > InputStream. I used EntityUtils.toByteArray to read data from entity. From > netstat, there are 50 connections. The thing confuses me is why it always > hits the same core when http responses are processed from multiple threads. > Any ideas? > > Thanks in advance, > > Ke The only rational theory I can think of is that the ReentrantLock guarding the connection pool favors certain threads due to 'unfair' behavior used by default. Still, I would presume that threads should not be bound to one core only and the load should get distributed evenly. Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org For additional commands, e-mail: httpclient-users-help@hc.apache.org