Return-Path: Delivered-To: apmail-jakarta-httpclient-dev-archive@www.apache.org Received: (qmail 61358 invoked from network); 23 Dec 2005 19:18:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 23 Dec 2005 19:18:53 -0000 Received: (qmail 39117 invoked by uid 500); 23 Dec 2005 19:18:52 -0000 Delivered-To: apmail-jakarta-httpclient-dev-archive@jakarta.apache.org Received: (qmail 39094 invoked by uid 500); 23 Dec 2005 19:18:51 -0000 Mailing-List: contact httpclient-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "HttpClient Project" Reply-To: "HttpClient Project" Delivered-To: mailing list httpclient-dev@jakarta.apache.org Received: (qmail 39083 invoked by uid 99); 23 Dec 2005 19:18:51 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Dec 2005 11:18:51 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [195.186.19.66] (HELO mail22.bluewin.ch) (195.186.19.66) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Dec 2005 11:18:50 -0800 Received: from [192.168.0.2] (213.3.55.77) by mail22.bluewin.ch (Bluewin 7.2.069.1) id 4392616600461423 for httpclient-dev@jakarta.apache.org; Fri, 23 Dec 2005 19:18:28 +0000 Subject: [HttpComponents] Garbage and memory footprint optimization of HttpCore - aftermath From: Oleg Kalnichevski To: HttpClient Project Content-Type: text/plain Date: Fri, 23 Dec 2005 20:18:27 +0100 Message-Id: <1135365507.2740.27.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Folks, As you know the HttpCore classes have been refactored heavily in an attempt to reduce the amount of intermediate garbage generated when parsing and transmitting HTTP messages and the overall memory footprint. I have compared the performance of a snapshot dated 22/10/2005 against the SVN trunk and found that the new code tends to perform better by 4-6% consistently across on all platforms and JREs I tested with. Not really a lot but still an improvement The memory consumption is a little harder to quantify, because the benchmarking tool I have been using generates some garbage and thus distorts the numbers. The hard fact is that the new code causes 2.5 - 3 times fewer GC runs executing the equal number of requests and tends to consume 20% to 30% less heap memory. I do not claim these results being very accurate but they do seem to support the general assumptions and conclusions Merry Christmas to those who celebrate it, Happy Hacking to those who do not Oleg ==================================== WinXP SP2 ==================================== > /data/src/apache.org/jakarta-httpcomponents/trunk/http-core $ java -cp `cygpath -w -p bin:/opt/libjava/apache.org/jakarta-commons/lib/commons-cli-1.0.jar` org.apache.http.contrib. benchmark.HttpBenchmark -n 50000 -k http://localhost:8080/servlets-examples/servlet/RequestInfoExample Server Software: Apache-Coyote/1.1 Server Hostname: localhost Server Port: 8080 Document Path: /servlets-examples/servlet/RequestInfoExample Document Length: 689 bytes Time taken for tests: 42.686 seconds Complete requests: 50000 Failed requests: 0 Content transferred: 34450000 bytes Requests per second: 1171.3442 [#/sec] (mean) Time per request: 0.85372 [ms] (mean) > /data/src/apache.org/jakarta-httpcomponents-22102005/trunk/http-core $ java -cp `cygpath -w -p bin:/opt/libjava/apache.org/jakarta-commons/lib/commons-cli-1.0.jar` org.apache.http.contrib. benchmark.HttpBenchmark -n 50000 -k http://localhost:8080/servlets-examples/servlet/RequestInfoExample Server Software: Apache-Coyote/1.1 Server Hostname: localhost Server Port: 8080 Document Path: /servlets-examples/servlet/RequestInfoExample Document Length: 689 bytes Time taken for tests: 45.14 seconds Complete requests: 50000 Failed requests: 0 Content transferred: 34450000 bytes Requests per second: 1107.665 [#/sec] (mean) Time per request: 0.9028 [ms] (mean) > /data/src/apache.org/jakarta-httpcomponents/trunk/http-core $ java -verbose:gc -cp `cygpath -w -p bin:/opt/libjava/apache.org/jakarta-commons/lib/commons-cli-1.0.jar` org.apache.h ttp.contrib.benchmark.HttpBenchmark -n 1000 -k http://localhost:8080/servlets-examples/servlet/RequestInfoExample [GC 511K->106K(1984K), 0.0042888 secs] [GC 618K->203K(1984K), 0.0037913 secs] [GC 715K->200K(1984K), 0.0016407 secs] [GC 712K->200K(1984K), 0.0002877 secs] [GC 712K->199K(1984K), 0.0002794 secs] [GC 711K->199K(1984K), 0.0004637 secs] Server Software: Apache-Coyote/1.1 Server Hostname: localhost Server Port: 8080 Document Path: /servlets-examples/servlet/RequestInfoExample Document Length: 689 bytes Time taken for tests: 1.234 seconds Complete requests: 1000 Failed requests: 0 Content transferred: 689000 bytes Requests per second: 810.3728 [#/sec] (mean) Time per request: 1.234 [ms] (mean) > /data/src/apache.org/jakarta-httpcomponents-22102005/trunk/http-core $ java -verbose:gc -cp `cygpath -w -p bin:/opt/libjava/apache.org/jakarta-commons/lib/commons-cli-1.0.jar` org.apache.h ttp.contrib.benchmark.HttpBenchmark -n 1000 -k http://localhost:8080/servlets-examples/servlet/RequestInfoExample [GC 511K->135K(1984K), 0.0047470 secs] [GC 645K->244K(1984K), 0.0042450 secs] [GC 756K->354K(1984K), 0.0040740 secs] [GC 866K->436K(1984K), 0.0026956 secs] [GC 948K->527K(1984K), 0.0026637 secs] [GC 1039K->523K(1984K), 0.0005124 secs] [GC 1035K->523K(1984K), 0.0004587 secs] [GC 1035K->522K(1984K), 0.0006627 secs] [GC 1034K->522K(1984K), 0.0006671 secs] [GC 1034K->522K(1984K), 0.0005649 secs] [GC 1033K->522K(1984K), 0.0003959 secs] [GC 1034K->524K(1984K), 0.0003808 secs] [GC 1036K->523K(1984K), 0.0003405 secs] [GC 1035K->523K(1984K), 0.0003369 secs] [GC 1035K->522K(1984K), 0.0003389 secs] [GC 1034K->522K(1984K), 0.0003931 secs] [GC 1034K->522K(1984K), 0.0003671 secs] [GC 1033K->522K(1984K), 0.0003319 secs] Server Software: Apache-Coyote/1.1 Server Hostname: localhost Server Port: 8080 Document Path: /servlets-examples/servlet/RequestInfoExample Document Length: 689 bytes Time taken for tests: 1.281 seconds Complete requests: 1000 Failed requests: 0 Content transferred: 689000 bytes Requests per second: 780.64014 [#/sec] (mean) Time per request: 1.281 [ms] (mean) ==================================== Fedora Core 4 Linux ==================================== > /home/oleg/src/apache.org/jakarta-httpcomponents/http-core [oleg@localhost http-core]$ /opt/sun-jdk-1.5.0/bin/java -cp bin:/usr/share/java/commons-cli.jar org.apache.http.contrib.benchmark.HttpBenchmark -k -n 50000 http://localhost/docs/mod/quickreference.html Server Software: Apache/2.0.54 (Fedora) Server Hostname: localhost Server Port: 80 Document Path: /docs/mod/quickreference.html Document Length: 96353 bytes Time taken for tests: 40.714 seconds Complete requests: 50000 Failed requests: 0 Content transferred: 4817650000 bytes Requests per second: 1228.0787 [#/sec] (mean) Time per request: 0.81428 [ms] (mean) > /home/oleg/src/apache.org/jakarta-httpcomponents-20051022/http-core [oleg@localhost http-core]$ /opt/sun-jdk-1.5.0/bin/java -cp bin:/usr/share/java/commons-cli.jar org.apache.http.contrib.benchmark.HttpBenchmark -k -n 50000 http://localhost/docs/mod/quickreference.html Server Software: Apache/2.0.54 (Fedora) Server Hostname: localhost Server Port: 80 Document Path: /docs/mod/quickreference.html Document Length: 96353 bytes Time taken for tests: 42.359 seconds Complete requests: 50000 Failed requests: 0 Content transferred: 4817650000 bytes Requests per second: 1180.3867 [#/sec] (mean) Time per request: 0.84718 [ms] (mean) > /home/oleg/src/apache.org/jakarta-httpcomponents/http-core [oleg@localhost http-core]$ /opt/sun-jdk-1.5.0/bin/java -verbose:gc -cp bin:/usr/share/java/commons-cli.jar org.apache.http.contrib.benchmark.HttpBenchmark -k -n 1000 http://localhost/docs/mod/quickreference.html [GC 512K->136K(1984K), 0.0028660 secs] [GC 643K->161K(1984K), 0.0029380 secs] [GC 673K->268K(1984K), 0.0014830 secs] [GC 780K->338K(1984K), 0.0007430 secs] [GC 850K->404K(1984K), 0.0005600 secs] [GC 916K->474K(1984K), 0.0004010 secs] [GC 963K->539K(1984K), 0.0004950 secs] [GC 1051K->584K(1984K), 0.0003700 secs] [GC 1096K->696K(1984K), 0.0006680 secs] [GC 1208K->762K(1984K), 0.0003860 secs] [GC 1274K->832K(1984K), 0.0004240 secs] [GC 1344K->897K(1984K), 0.0003880 secs] [GC 1409K->964K(1984K), 0.0004290 secs] Server Software: Apache/2.0.54 (Fedora) Server Hostname: localhost Server Port: 80 Document Path: /docs/mod/quickreference.html Document Length: 96353 bytes Time taken for tests: 1.166 seconds Complete requests: 1000 Failed requests: 0 Content transferred: 96353000 bytes Requests per second: 857.63293 [#/sec] (mean) Time per request: 1.166 [ms] (mean) > /home/oleg/src/apache.org/jakarta-httpcomponents-20051022/http-core [oleg@localhost http-core]$ /opt/sun-jdk-1.5.0/bin/java -verbose:gc -cp bin:/usr/share/java/commons-cli.jar org.apache.http.contrib.benchmark.HttpBenchmark -k -n 1000 http://localhost/docs/mod/quickreference.html [GC 512K->138K(1984K), 0.0026370 secs] [GC 650K->156K(1984K), 0.0022690 secs] [GC 668K->269K(1984K), 0.0014760 secs] [GC 781K->270K(1984K), 0.0007390 secs] [GC 782K->381K(1984K), 0.0004650 secs] [GC 893K->381K(1984K), 0.0004980 secs] [GC 885K->446K(1984K), 0.0004090 secs] [GC 958K->490K(1984K), 0.0003590 secs] [GC 1002K->492K(1984K), 0.0002890 secs] [GC 1004K->604K(1984K), 0.0004220 secs] [GC 1115K->600K(1984K), 0.0005070 secs] [GC 1112K->711K(1984K), 0.0004780 secs] [GC 1223K->713K(1984K), 0.0003360 secs] [GC 1225K->821K(1984K), 0.0005660 secs] [GC 1333K->826K(1984K), 0.0003070 secs] [GC 1337K->821K(1984K), 0.0002870 secs] [GC 1332K->907K(1984K), 0.0004040 secs] [GC 1419K->907K(1984K), 0.0002740 secs] [GC 1419K->995K(1984K), 0.0005550 secs] [GC 1507K->992K(1984K), 0.0003420 secs] [GC 1504K->1103K(1984K), 0.0004020 secs] [GC 1615K->1103K(1984K), 0.0002620 secs] [GC 1615K->1193K(1984K), 0.0004040 secs] [GC 1705K->1189K(1984K), 0.0003120 secs] Server Software: Apache/2.0.54 (Fedora) Server Hostname: localhost Server Port: 80 Document Path: /docs/mod/quickreference.html Document Length: 96353 bytes Time taken for tests: 1.36 seconds Complete requests: 1000 Failed requests: 0 Content transferred: 96353000 bytes Requests per second: 735.2941 [#/sec] (mean) Time per request: 1.36 [ms] (mean) --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org