gregames 2002/10/16 08:37:22
Modified: specweb99/specweb99-2.0 mod_specweb99.c
Log:
Implement a quick handler hook for SPECWeb99 dynamic requests. This gets
rid of a stat and several lstats for URIs which do not exist in the
file system.
This improves performance on my wimp box* by slightly over 4% for
standard dynamic GETS (137 -> 143 conforming connections, compared to
145 conforming connections for 100% static GETs) Running the standard
SPECWeb99 workload mix, I see about a overall 2% inprovement in conforming
connections. Linux SMP boxes should do better because of reduced dcache
spinlock contention in the kernel.
There are several sections of code which are now redundant. I left those in
to make this commit easier to review, but plan to take them out soon. That
should improve performance further.
*wimp: 200 MHz Pentium Pro, 128M RAM, Red Hat 7.2. Anything faster would
just mean I need more ethernet cards and client horsepower.
Revision Changes Path
1.8 +25 -16 httpd-test/specweb99/specweb99-2.0/mod_specweb99.c
Index: mod_specweb99.c
===================================================================
RCS file: /home/cvs/httpd-test/specweb99/specweb99-2.0/mod_specweb99.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- mod_specweb99.c 4 Jun 2002 19:11:59 -0000 1.7
+++ mod_specweb99.c 16 Oct 2002 15:37:22 -0000 1.8
@@ -649,9 +649,6 @@
const char *docroot = ap_document_root(r);
apr_uri_t urlrootrec; /* To parse the urlroot string into */
- if (strcmp(r->handler, "specweb99hk"))
- return DECLINED;
-
if (strstr(r->args, "command/Fetch") != NULL) {
returnHTMLPageWithFile(r, _my->log_path);
return OK;
@@ -807,8 +804,6 @@
char *path;
const char *docroot = ap_document_root(r);
- if (strcmp(r->handler, "specweb99get"))
- return DECLINED;
/*
* This should not be tested for every request. Eventually, this code
* will find its way to the housekeeping command handler, but that does
@@ -908,8 +903,6 @@
u_int32_t userdemographics, combineddemographics; /* it's a bitmap */
u_int16_t ad_weight;
- if (strcmp(r->handler, "specweb99cadget"))
- return DECLINED;
/*
* This should not be tested for every request. Eventually, this code
* will find its way to the housekeeping command handler, but that does
@@ -1116,9 +1109,6 @@
long length = 0;
apr_status_t rv, rv2;
- if (strcmp(r->handler, "specweb99post"))
- return DECLINED;
-
docroot = ap_document_root(r);
/*Begin:*/
@@ -1320,15 +1310,34 @@
return OK;
} /* specweb99_post_handler */
+static int specweb99_quick_handler(request_rec *r, int lookup)
+{
+ const char *cookie_in;
+
+ if (!((strlen(r->uri) == 1) && /* dynamic uri is "/" */
+ (r->args || /* dynamic GET must have args */
+ r->method_number == M_POST))) { /* but not POST */
+ return DECLINED;
+ }
+ cookie_in = apr_table_get(r->headers_in, "Cookie");
+ if (cookie_in) {
+ if (r->method_number == M_GET) {
+ return specweb99_cadget_handler(r);
+ }
+ return specweb99_post_handler(r);
+ }
+ if (!strncmp(r->args, "command/", 8)) {
+ return specweb99_hk_handler(r);
+ }
+ return specweb99_get_handler(r);
+} /* specweb99_quick_handler */
+
static void register_hooks(apr_pool_t * p)
{
ap_hook_post_config(specweb99_module_init, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_child_init(specweb99_child_init, NULL, NULL, APR_HOOK_MIDDLE);
-
- ap_hook_handler(specweb99_hk_handler, NULL, NULL, APR_HOOK_MIDDLE);
- ap_hook_handler(specweb99_get_handler, NULL, NULL, APR_HOOK_MIDDLE);
- ap_hook_handler(specweb99_cadget_handler, NULL, NULL, APR_HOOK_MIDDLE);
- ap_hook_handler(specweb99_post_handler, NULL, NULL, APR_HOOK_MIDDLE);
+
+ ap_hook_quick_handler(specweb99_quick_handler, NULL, NULL, APR_HOOK_MIDDLE);
}
|