Return-Path: Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: (qmail 42490 invoked from network); 13 Jun 2008 08:18:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Jun 2008 08:18:45 -0000 Received: (qmail 74715 invoked by uid 500); 13 Jun 2008 08:18:47 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 74684 invoked by uid 500); 13 Jun 2008 08:18:47 -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 74667 invoked by uid 99); 13 Jun 2008 08:18:47 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Jun 2008 01:18:47 -0700 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.200.173] (HELO wf-out-1314.google.com) (209.85.200.173) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Jun 2008 08:17:55 +0000 Received: by wf-out-1314.google.com with SMTP id 23so4172794wfg.10 for ; Fri, 13 Jun 2008 01:18:11 -0700 (PDT) Received: by 10.143.163.3 with SMTP id q3mr942523wfo.294.1213345089703; Fri, 13 Jun 2008 01:18:09 -0700 (PDT) Received: by 10.142.131.13 with HTTP; Fri, 13 Jun 2008 01:18:09 -0700 (PDT) Message-ID: <1f3854d50806130118n39f5afc4lf1f8aec16baa5717@mail.gmail.com> Date: Fri, 13 Jun 2008 10:18:09 +0200 From: "Quintin Beukes" Sender: quintin@skywalk.co.za To: "HttpClient User Discussion" Subject: Re: Higher Throughputs In-Reply-To: <1213344477.6206.9.camel@ubuntu> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1f3854d50806121307w4bdb5cddp51b670838015e444@mail.gmail.com> <48518ED9.1060502@apache.org> <1f3854d50806122335o2779f5d4ifccd285158ba57b9@mail.gmail.com> <1213344477.6206.9.camel@ubuntu> X-Google-Sender-Auth: 78b7d272b40e93ec X-Virus-Checked: Checked by ClamAV on apache.org I'm doing ethernet. Localhost is also quite unpredictable, as it can go too fast. Doing ethernet I know what the limits are, ie. 100mbit or 1gbit. Eitherway, I setup some benchmarks and got very high troughputs. I also spent some time figuring out HttpCore, so it's much faster than all the others now. My question is then more of the sort, what could the reason for this be? It's probably not HttpClient's fault though. Any ideas how I can find the bottleneck? Q On Fri, Jun 13, 2008 at 10:07 AM, Oleg Kalnichevski wrote: > On Fri, 2008-06-13 at 08:35 +0200, Quintin Beukes wrote: >> Hey, >> >> That's an idea (to first get the code optimized before squeezing it >> into tomcat). I guess I just continued this way, as our current system >> is using HttpURLConnection. So I wanted to get an idea of how it will >> compare. >> >> I'll take your advice on running it in separate java apps? I assume >> that is what you meant "direct connections", as in no proxied >> connections via tomcat. >> > > Yep. > >> If someone had to take a wild guess, which of the examples of the site >> can I use as a base if I'm targeting performance (a good balance >> between throughput and high connection/second rates would be the >> best)? >> > > Most likely you want to run benchmarks against a site with a predictable > routing overhead. If there are too many hops in between you can never be > sure exactly what you are measuring: the performance of the HTTP stack > or that of your Internet service provider's routing infrastructure. > > I guess 'localhost' is your best friend. > > Oleg > >> Q >> >> On Thu, Jun 12, 2008 at 11:02 PM, Oleg Kalnichevski wrote: >> > Quintin Beukes wrote: >> >> >> >> Hey, >> >> >> >> I made some basic servlets to test throughputs for HttpClient, >> >> HttpCore and sun's sun.net.www.protocol.http.HttpURLConnection (or >> >> something along those lines, I don't have an API at hand now). >> >> >> >> I basically just put up an apache session listening on port 8580, and >> >> then Tomcat on port 80. In tomcat I dumped 3 servlets, each using one >> >> of the 3 methods to retrieve a 51kb page from the apache session. >> >> >> >> The benchmarks was done with "ab" with 10 second timeouts. The results >> >> are as follows (in byte readings, not bit readings). >> >> >> >> Doing a direct request to apache I get a throughput of about 33mb/s. >> >> Using HttpURLConnection, 4.7MB/s. >> >> Using HttpCore 3.6MB/s >> >> Using HttpClient 6.03mb/s >> >> >> >> The request times were in general best with apache/HttpClient, maxing >> >> at 38ms for the longest request. >> >> >> >> This was done at a concurrency of 1 connection. Pushing this up to 5, >> >> the HttpCore's connection times stayed the same, but throughput >> >> dropped to 980kb/s. HttpClient's connection times now came to the same >> >> as HttpCore (230ms for longest request), but it's throughput increased >> >> to 7.1mb/s. >> >> >> >> This is all good and well, but my question is this. Are there any ways >> >> I can increase these throughputs? Before just jumping into >> >> optimizations suggestions and referals to documentation, could someone >> >> perhaps just enlighten me into why these speeds are so different. And >> >> especially so low? >> >> >> > >> > I do not want to jump into conclusions here, but I seriously suspect >> > something is wrong with your test cases. In particular I do not understand >> > why you are using Tomcat to host the code your are testing. What is the >> > point of that? >> > >> > I made an extensive comparison of HttpCore vs HttpClient (both versions 3.1 >> > and 4.0). HttpCore can easily achieve a throughput of 10,000 (small) >> > requests per second on a fairly average hardware. >> > >> > http://wiki.apache.org/HttpComponents/HttpClient3vsHttpClient4vsHttpCore >> > >> > >> >> I am obviously using HttpCore wrong for it to be so slow (I mean, >> >> HttpClient is built on core, so it's impossible to be faster). It's >> >> just that the documentation for these are sparse, and I'm having a >> >> very hard time finding my way around. >> >> >> >> And beyond this, Tomcat itself gives me fantastic speeds reading >> >> static data. Where are the bottlenecks? >> >> >> >> The HttpCore setup I used was the "Basic GET Requests" example >> >> available on the site. I modified it a bit to allow URL input and >> >> target server specified through parameters passed to the servlet. >> >> Beyond that I didn't change anything. My assumption is that >> >> connections aren't being reused. In fact, I know this is the case, so >> >> it logically and obviously removes the validity of the above >> >> benchmarks for HttpCore. I'm not going to remove them though. >> >> >> >> I would really like to get throughputs similar to direct Apache >> >> connections (at least 33+ mbyte/s, which is round about the general >> >> limit of hard drive transfer rates). Full ethernet throughput is >> >> preferable and I'm sure possible. Downloading large files I get speeds >> >> of up to 54mbyte/s with Apache. I'm sure this is limited only to the >> >> hard drive I tested with, as it's a gigabit connection, and this is >> >> just less than half it's full potential. I haven't done tests using >> >> memory transfer. Will try it when I can diagnose the bottlenecks I >> >> currently have, and then use them as measurements to gain insights >> >> into the speed of the program itself by taking as much of the other >> >> bottlenecks in the system away as possible (in this case the >> >> limitation of data transfer rates from the hard drives). >> >> >> >> The three benchmark servlets I used are here: >> >> HttpClient: http://quintin.dev.junkmail.co.za/httpclient/Bench.java >> >> HttpCore: http://quintin.dev.junkmail.co.za/httpclient/BenchCore.java >> >> HttpURLConn: http://quintin.dev.junkmail.co.za/httpclient/BenchURL.java >> >> >> >> And a utility class I use in the above: >> >> http://quintin.dev.junkmail.co.za/httpclient/StreamBinder.java >> >> >> >> Any insights would be greatly appreciated. >> >> >> > >> > I'll try to look at the benchmark code over the weekend. But I would >> > _strongly_ suggest measuring the performance of each respective framework by >> > using direct connections to the target server. Once you have established the >> > baseline you can work on optimizing the code when running inside a servlet >> > container. >> > >> > Oleg >> > >> >> regards, >> > >> > >> > --------------------------------------------------------------------- >> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org >> > For additional commands, e-mail: httpclient-users-help@hc.apache.org >> > >> > >> >> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org > For additional commands, e-mail: httpclient-users-help@hc.apache.org > > -- Quintin Beukes --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org For additional commands, e-mail: httpclient-users-help@hc.apache.org