]> granicus.if.org Git - apache/commitdiff
lookup_map_txtfile: used buffered i/o rather than reading RewriteMap txt: files
authorGreg Ames <gregames@apache.org>
Thu, 14 Apr 2005 21:26:01 +0000 (21:26 +0000)
committerGreg Ames <gregames@apache.org>
Thu, 14 Apr 2005 21:26:01 +0000 (21:26 +0000)
one byte at a time.

I was horrified to see a dump of a server with hundreds of worker threads in
read() syscalls,  all trying to read a 149k RewriteMap file simultaneously.
each thread finds one key, inserts it into the cache, then the rest of the
information is discarded.  there are further improvements which could be made but
let's try the simplest first.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@161354 13f79535-47bb-0310-9956-ffa450edef68

modules/mappers/mod_rewrite.c

index aab63cbe597d92b8d2e59266b2367662609a3651..0baad438002ad1b33ce3428abbe239c079c4dbb2 100644 (file)
@@ -1238,7 +1238,7 @@ static char *lookup_map_txtfile(request_rec *r, const char *file, char *key)
     char line[REWRITE_MAX_TXT_MAP_LINE + 1]; /* +1 for \0 */
     char *value, *keylast;
 
-    if (apr_file_open(&fp, file, APR_READ, APR_OS_DEFAULT,
+    if (apr_file_open(&fp, file, APR_READ|APR_BUFFERED, APR_OS_DEFAULT,
                       r->pool) != APR_SUCCESS) {
         return NULL;
     }