Return-Path: Delivered-To: apmail-new-httpd-archive@apache.org Received: (qmail 21116 invoked by uid 500); 2 May 2001 17:05:09 -0000 Mailing-List: contact new-httpd-help@apache.org; run by ezmlm Precedence: bulk Reply-To: new-httpd@apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list new-httpd@apache.org Received: (qmail 18829 invoked from network); 2 May 2001 17:00:26 -0000 Message-ID: <3482305AF0F6CF469ED45C0D48FAFCF7091FF144@cnet10.cnet.com> From: Ian Holsman To: "'new-httpd@apache.org'" Subject: [PATCH] mod_include -- Only evaluate the environmentvariables wh en needed - #2 Date: Wed, 2 May 2001 09:55:16 -0700 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: multipart/mixed; boundary="----_=_NextPart_000_01C0D328.A9F39780" X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_000_01C0D328.A9F39780 Content-Type: text/plain; charset="iso-8859-1" here is a update of the patch, (the old one had a bug in it when you used a env variable in a virtual include) My testing on linux and solaris shows an overall improvement in times and machine load (I've included some output from AB from the linux test) David Reid's testing shows that it is actually slower on FreeBSD 4, but I don't have access to FreeBSD to find out why > > > > Ian, > > > > Bad news. I've added the patch, rebuilt and don't see any > > significant increase > > in speed. In fact I'm actually seeing a very small drop. > > The system is > > FreeBSD 4 STABLE running on a PIII 700 using localhost. 2 > > test files, one with > > only an include (test 2) and another with the same include, > > printenv and echo > > (test 1) commands. The difference goes like... > > > > before after > > test 1 480-490 455-475 > > test 2 590-600 560-580 > > > > Not sure why there should be a drop, but it could be > > something to do with the > > extra table calls that your patch adds, or seems to. > > > > set_lazy_vars has a call to apr_setn and we call it a few > > times now that we > > didn't before... table operations can be expensive so this > > could be part of > > the problem. I guess it depends on your system ?? Just for > > my information, > > why do you make the call to add the table variables? > > > > So, I'm not going to add the patch, sorry. I like the idea, > > but for some > > reason it isn't quite working... If you want to try again > > just let me know. > > > >> ------_=_NextPart_000_01C0D328.A9F39780 Content-Type: text/plain; name="mod_include_results.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="mod_include_results.txt" -- Old mod_include -- [root@garuda apache]# bin/ab -c 50 -n 5000 = http://127.0.0.1:8080/ssi/main.html This is ApacheBench, Version 1.3e = <$Revision: 1.70 $> apache-2.0 Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, = http://www.zeustech.net/ Copyright (c) 1998-2001 The Apache Software Foundation, = http://www.apache.org/ Benchmarking 127.0.0.1 (be patient) Completed 500 requests Completed 1000 requests Completed 1500 requests Completed 2000 requests Completed 2500 requests Completed 3000 requests Completed 3500 requests Completed 4000 requests Completed 4500 requests Finished 5000 requests Server Software: Apache/2.0.18-dev Server Hostname: 127.0.0.1 Server Port: 8080 Document Path: /ssi/main.html Document Length: 33513 bytes Concurrency Level: 50 Time taken for tests: 26.695395 seconds Complete requests: 5000 Failed requests: 0 Write errors: 0 Total transferred: 168820000 bytes HTML transferred: 167565000 bytes Requests per second: 187.30 [#/sec] (mean) Time per request: 0.267 [ms] (mean) Time per request: 0.005 [ms] (mean, across all concurent = requests) Transfer rate: 6175.71 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 1 42.3 0 2991 Processing: 18 264 294.7 234 3225 Waiting: 2 107 267.2 81 3164 Total: 18 265 297.6 234 3225 Percentage of the requests served within a certain time (ms) 50% 234 66% 238 75% 240 80% 241 90% 246 95% 249 98% 255 99% 3218 100% 3225 (longest request) [root@garuda apache]# bin/ab -c 100 -n 5000 = http://127.0.0.1:8080/ssi/main.html This is ApacheBench, Version 1.3e <$Revision: 1.70 $> apache-2.0 Copyright (c) 1998-2001 The Apache Software Foundation, = http://www.apache.org/ Benchmarking 127.0.0.1 (be patient) Completed 500 requests Completed 1000 requests Completed 1500 requests Completed 2000 requests Completed 2500 requests Completed 3000 requests Completed 3500 requests Completed 4000 requests Completed 4500 requests Finished 5000 requests Server Software: Apache/2.0.18-dev Server Hostname: 127.0.0.1 Server Port: 8080 Document Path: /ssi/main.html Document Length: 33513 bytes Concurrency Level: 100 Time taken for tests: 26.834145 seconds Complete requests: 5000 Failed requests: 0 Write errors: 0 Total transferred: 168820000 bytes HTML transferred: 167565000 bytes Requests per second: 186.33 [#/sec] (mean) Time per request: 0.537 [ms] (mean) Time per request: 0.005 [ms] (mean, across all concurent = requests) Transfer rate: 6143.78 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 1 42.4 0 2998 Processing: 35 532 418.6 478 3470 Waiting: 4 113 146.4 86 3127 Total: 35 532 420.5 478 3470 Percentage of the requests served within a certain time (ms) 50% 478 66% 484 75% 485 80% 487 90% 507 95% 544 98% 3359 99% 3464 100% 3470 (longest request) [root@garuda apache]# bin/apachectl stop bin/apachectl stop: httpd stopped [root@garuda apache]# -- new mod_include -- [root@garuda apache]# bin/ab -c 50 -n 5000 = http://127.0.0.1:8080/ssi/main.html This is ApacheBench, Version 1.3e = <$Revision: 1.70 $> apache-2.0 Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, = http://www.zeustech.net/ Copyright (c) 1998-2001 The Apache Software Foundation, = http://www.apache.org/ Benchmarking 127.0.0.1 (be patient) Completed 500 requests Completed 1000 requests Completed 1500 requests Completed 2000 requests Completed 2500 requests Completed 3000 requests Completed 3500 requests Completed 4000 requests Completed 4500 requests Finished 5000 requests Server Software: Apache/2.0.18-dev Server Hostname: 127.0.0.1 Server Port: 8080 Document Path: /ssi/main.html Document Length: 33513 bytes Concurrency Level: 50 Time taken for tests: 22.568364 seconds Complete requests: 5000 Failed requests: 0 Write errors: 0 Total transferred: 168820000 bytes HTML transferred: 167565000 bytes Requests per second: 221.55 [#/sec] (mean) Time per request: 0.226 [ms] (mean) Time per request: 0.005 [ms] (mean, across all concurent = requests) Transfer rate: 7305.05 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.2 0 8 Processing: 23 223 15.4 223 331 Waiting: 1 74 53.4 68 230 Total: 23 223 15.4 223 331 Percentage of the requests served within a certain time (ms) 50% 223 66% 224 75% 226 80% 227 90% 234 95% 237 98% 245 99% 250 100% 331 (longest request) -- [root@garuda apache]# bin/ab -c 100 -n 5000 = http://127.0.0.1:8080/ssi/main.html This is ApacheBench, Version 1.3e <$Revision: 1.70 $> apache-2.0 Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, = http://www.zeustech.net/ Copyright (c) 1998-2001 The Apache Software Foundation, = http://www.apache.org/ Benchmarking 127.0.0.1 (be patient) Completed 500 requests Completed 1000 requests Completed 1500 requests Completed 2000 requests Completed 2500 requests Completed 3000 requests Completed 3500 requests Completed 4000 requests Completed 4500 requests Finished 5000 requests Server Software: Apache/2.0.18-dev Server Hostname: 127.0.0.1 Server Port: 8080 Document Path: /ssi/main.html Document Length: 33513 bytes Concurrency Level: 100 Time taken for tests: 22.571021 seconds Complete requests: 5000 Failed requests: 0 Write errors: 0 Total transferred: 168820000 bytes HTML transferred: 167565000 bytes Requests per second: 221.52 [#/sec] (mean) Time per request: 0.451 [ms] (mean) Time per request: 0.005 [ms] (mean, across all concurent = requests) Transfer rate: 7304.19 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.3 0 9 Processing: 39 448 49.6 448 763 Waiting: 5 104 93.9 63 458 Total: 39 448 49.7 448 763 Percentage of the requests served within a certain time (ms) 50% 448 66% 449 75% 453 80% 457 90% 473 95% 494 98% 534 99% 559 100% 763 (longest request) [root@garuda apache]# ------_=_NextPart_000_01C0D328.A9F39780 Content-Type: application/octet-stream; name="mod_include.patch" Content-Disposition: attachment; filename="mod_include.patch" Index: mod_include.c =================================================================== RCS file: /home/cvspublic/httpd-2.0/modules/filters/mod_include.c,v retrieving revision 1.109 diff -u -r1.109 mod_include.c --- mod_include.c 2001/04/21 22:01:05 1.109 +++ mod_include.c 2001/05/02 03:42:05 @@ -98,6 +98,9 @@ #define BYTE_COUNT_THRESHOLD AP_MIN_BYTES_TO_WRITE + + +static void set_lazy_vars( request_rec *r ) ; /* ------------------------ Environment function -------------------------- */ /* XXX: could use ap_table_overlap here */ @@ -637,6 +640,7 @@ const char *expansion, *temp_end, *val; char tmp_store; size_t l; + set_lazy_vars(r); /* guess that the expansion won't happen */ expansion = in - 1; @@ -889,6 +893,9 @@ encode = E_ENTITY; *inserted_head = NULL; + + set_lazy_vars(r); + if (ctx->flags & FLAG_PRINTING) { while (1) { ap_ssi_get_tag_and_value(ctx, &tag, &tag_val, 1); @@ -2299,6 +2306,8 @@ char *tag_val = NULL; apr_bucket *tmp_buck; + set_lazy_vars(r); + if (ctx->flags & FLAG_PRINTING) { ap_ssi_get_tag_and_value(ctx, &tag, &tag_val, 1); if ((tag == NULL) && (tag_val == NULL)) { @@ -2747,9 +2756,7 @@ else { /* we're not a nested include, so we create an initial * environment */ - ap_add_common_vars(r); - ap_add_cgi_vars(r); - add_include_vars(r, conf->default_time_fmt); + apr_table_unset( r->subprocess_env, "INCLUDE_VARS" ); } /* XXX: this is bogus, at some point we're going to do a subrequest, * and when we do it we're going to be subjecting code that doesn't @@ -2817,6 +2824,22 @@ include_dir_config *conf = (include_dir_config *)mconfig; conf->default_time_fmt = apr_pstrdup(cmd->pool, fmt); return NULL; +} +/* + * Perform a evaluation of Standard SSI Include vars if they have not been included already + * + */ +static void set_lazy_vars( request_rec *r ) +{ + + if ( apr_table_get( r->subprocess_env, "INCLUDE_VARS" ) == NULL ) { + include_dir_config *conf = (include_dir_config *)ap_get_module_config(r->per_dir_config, + &include_module); + apr_table_setn(r->subprocess_env, "INCLUDE_VARS", "Y"); + ap_add_common_vars(r); + ap_add_cgi_vars(r); + add_include_vars(r, conf->default_time_fmt); + } } /* ------_=_NextPart_000_01C0D328.A9F39780--