From: Greg Ames Date: Thu, 14 Apr 2005 21:26:01 +0000 (+0000) Subject: lookup_map_txtfile: used buffered i/o rather than reading RewriteMap txt: files X-Git-Tag: 2.1.5~187 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0aee87d2ee7af85e9c138d48eda920c5be323238;p=thirdparty%2Fapache%2Fhttpd.git lookup_map_txtfile: used buffered i/o rather than reading RewriteMap txt: files 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 --- diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index aab63cbe597..0baad438002 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -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; }