cvs commit: apachen/src/modules/standard mod_unique_id.c
dgaudet 97/10/24 01:56:48 Modified:src/modules/standard mod_unique_id.c Log: I'm in the middle of documenting the algorithm used here... I found another problem to defend against. Revision ChangesPath 1.7 +4 -1 apachen/src/modules/standard/mod_unique_id.c Index: mod_unique_id.c === RCS file: /export/home/cvs/apachen/src/modules/standard/mod_unique_id.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- mod_unique_id.c 1997/10/22 20:30:30 1.6 +++ mod_unique_id.c 1997/10/24 08:56:46 1.7 @@ -245,7 +245,10 @@ cur_unique_id.counter = 0; } else { -cur_unique_id.counter = tv.tv_usec; + /* Some systems have very low variance on the low end of their + * system counter, defend against that. + */ +cur_unique_id.counter = tv.tv_usec / 10; } #else cur_unique_id.counter = 0;
cvs commit: apachen/htdocs/manual/mod mod_unique_id.html index.html
dgaudet 97/10/24 02:34:22 Modified:htdocs/manual/mod index.html Added: htdocs/manual/mod mod_unique_id.html Log: Document mod_unique_id.html. Revision ChangesPath 1.21 +1 -1 apachen/htdocs/manual/mod/index.html Index: index.html === RCS file: /export/home/cvs/apachen/htdocs/manual/mod/index.html,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- index.html1997/09/12 09:36:18 1.20 +++ index.html1997/10/24 09:34:21 1.21 @@ -107,7 +107,7 @@ ddServer status display dtA HREF=mod_userdir.htmlmod_userdir/A ddUser home directories. -dtxA HREF=mod_unique_id.htmlmod_unique_id/A Apache 1.3 and up +dtA HREF=mod_unique_id.htmlmod_unique_id/A Apache 1.3 and up ddGenerate unique request identifier for every request dtA HREF=mod_usertrack.htmlmod_usertrack/A Apache 1.2 and up ddUser tracking using Cookies (replacement for mod_cookies.c) 1.1 apachen/htdocs/manual/mod/mod_unique_id.html Index: mod_unique_id.html === !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 3.2 Final//EN HTML HEAD TITLEApache module mod_unique_id/TITLE /HEAD !-- Background white, links blue (unvisited), navy (visited), red (active) -- BODY BGCOLOR=#FF TEXT=#00 LINK=#FF VLINK=#80 ALINK=#FF !--#include virtual=header.html -- H1 ALIGN=CENTERModule mod_unique_id/h1 This module provides a magic token for each request which is guaranteed to be unique across all requests under very specific conditions. The unique identifier is even unique across multiple machines in a properly configured cluster of machines. The environment variable codeUNIQUE_ID/code is set to the identifier for each request. Unique identifiers are useful for various reasons which are beyond the scope of this document. h2Theory/h2 p First a brief recap of how the Apache server works on Unix machines. This feature currently isn't supported on Windows NT. On Unix machines, Apache creates several children, the children process requests one at a time. Each child can serve multiple requests in its lifetime. For the purpose of this discussion, the children don't share any data with each other. We'll refer to the children as httpd processes. p Your website has one or more machines under your administrative control, together we'll call them a cluster of machines. Each machine can possibly run multiple instances of Apache. All of these collectively are considered the universe, and with certain assumptions we'll show that in this universe we can generate unique identifiers for each request, without extensive communication between machines in the cluster. p The machines in your cluster should satisfy these requirements. (Even if you have only one machine you should synchronize its clock with NTP.) ul liThe machines' times are synchronized via NTP or other network time protocol. liThe machines' hostnames all differ, such that the module can do a hostname lookup on the hostname and receive a different IP address for each machine in the cluster. /ul p As far as operating system assumptions go, we assume that pids (process ids) fit in 32-bits. If the operating system uses more than 32-bits for a pid, the fix is trivial but must be performed in the code. p Given those assumptions, at a single point in time we can identify any httpd process on any machine in the cluster from all other httpd processes. The machine's IP address and the pid of the httpd process are sufficient to do this. So in order to generate unique identifiers for requests we need only distinguish between different points in time. p To distinguish time we will use a Unix timestamp (seconds since January 1, 1970 UTC), and a 16-bit counter. The timestamp has only one second granularity, so the counter is used to represent up to 65536 values during a single second. The quadruple i( ip_addr, pid, time_stamp, counter )/i is sufficient to enumerate 65536 requests per second per httpd process. There are issues however with pid reuse over time, and the counter is used to alleviate this issue. p When an httpd child is created, the counter is initialized with ( current microseconds divided by 10 ) modulo 65536 (this formula was chosen to eliminate some variance problems with the low order bits of the microsecond timers on some systems). When a unique identifier is generated, the time stamp used is the time the request arrived at the web server. The counter is incremented every time an identifier is generated (and allowed to roll over). p The kernel generates a pid for each process as it forks the process, and pids are
cvs commit: apachen/htdocs/manual/misc perf-tuning.html
dgaudet 97/10/24 02:39:19 Modified:htdocs/manual/misc perf-tuning.html Log: document MMAP_SEGMENT_SIZE Revision ChangesPath 1.2 +16 -9 apachen/htdocs/manual/misc/perf-tuning.html Index: perf-tuning.html === RCS file: /export/home/cvs/apachen/htdocs/manual/misc/perf-tuning.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- perf-tuning.html 1997/09/30 23:24:30 1.1 +++ perf-tuning.html 1997/10/24 09:39:17 1.2 @@ -690,16 +690,23 @@ On some architectures it's slower to codemmap/code small files than it is to simply coderead/code them. The define -codeMMAP_THRESHOLD/code can be set to the minimum size required before -using codemmap/code. By default it's set to 0 (except on SunOS4 -where experimentation has shown 8192 to be a better value). Using a -tool such as -a href=http://reality.sgi.com/lm_engr/lmbench/lmbench.html;lmbench/a -you can determine the optimal setting for your -environment. It may even be the case that codemmap/code isn't used -on your architecture, if so then defining codeUSE_MMAP_FILES/code -might work (if it works then report back to us). +codeMMAP_THRESHOLD/code can be set to the minimum +size required before using codemmap/code. By default +it's set to 0 (except on SunOS4 where experimentation has +shown 8192 to be a better value). Using a tool such as a +href=http://reality.sgi.com/lm_engr/lmbench/lmbench.html;lmbench/a you +can determine the optimal setting for your environment. + +pYou may also wish to experiment with codeMMAP_SEGMENT_SIZE/code +(default 32768) which determines the maximum number of bytes that +will be written at a time from mmap()d files. Apache only resets the +client's codeTimeout/code in between write()s. So setting this +large may lock out low bandwidth clients unless you also increase the +codeTimeout/code. +pIt may even be the case that codemmap/code isn't +used on your architecture, if so then defining codeUSE_MMAP_FILES/code +might work (if it works then report back to us). pApache does its best to avoid copying bytes around in memory. The first write of any request typically is turned into a codewritev/code
cvs commit: apachen/htdocs/manual new_features_1_3.html
dgaudet 97/10/24 02:44:18 Modified:htdocs/manual new_features_1_3.html Log: update with mod_unique_id link Revision ChangesPath 1.29 +4 -5 apachen/htdocs/manual/new_features_1_3.html Index: new_features_1_3.html === RCS file: /export/home/cvs/apachen/htdocs/manual/new_features_1_3.html,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- new_features_1_3.html 1997/10/20 16:27:47 1.28 +++ new_features_1_3.html 1997/10/24 09:44:17 1.29 @@ -275,11 +275,10 @@ documentation/a for more information. listrongUnique Identifiers/strongbr -mod_unique_id can be included to generate a unique identifier that -distinguishes a hit from every other hit. (Unique has -some restrictions on it.) Documentation to be written. The -identifier is available in the environment variable -codeUNIQUE_ID/code. +a href=mod/mod_unique_id.htmlmod_unique_id/a can be included +to generate a unique identifier that distinguishes a hit from every +other hit. (Unique has some restrictions on it.) The identifier +is available in the environment variable codeUNIQUE_ID/code. listrongReliable Piped Logs/strongbr On almost all Unix architectures Apache now implements reliable
cvs commit: apachen/htdocs/manual index.html
dgaudet 97/10/24 02:53:40 Modified:htdocs/manual index.html Log: make it clear the docs are for 1.3 Revision ChangesPath 1.18 +2 -2 apachen/htdocs/manual/index.html Index: index.html === RCS file: /export/home/cvs/apachen/htdocs/manual/index.html,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- index.html1997/10/06 03:06:35 1.17 +++ index.html1997/10/24 09:53:39 1.18 @@ -1,7 +1,7 @@ !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 3.2 Final//EN HTML HEAD -TITLEApache documentation/TITLE +TITLEApache 1.3 documentation/TITLE /HEAD !-- Background white, links blue (unvisited), navy (visited), red (active) -- @@ -13,7 +13,7 @@ ALINK=#FF !--#include virtual=header.html -- -h1 ALIGN=CENTERApache User's Guide/h1 +h1 ALIGN=CENTERApache 1.3 User's Guide/h1 hr
cvs commit: apachen/src/main util_script.c
pcs 97/10/24 08:40:56 Modified:src/main util_script.c Log: Format recent patched code into Apache style Revision ChangesPath 1.82 +6 -5 apachen/src/main/util_script.c Index: util_script.c === RCS file: /export/home/cvs/apachen/src/main/util_script.c,v retrieving revision 1.81 retrieving revision 1.82 diff -u -r1.81 -r1.82 --- util_script.c 1997/10/22 20:29:53 1.81 +++ util_script.c 1997/10/24 15:40:55 1.82 @@ -734,11 +734,12 @@ } } - /* FIXME: Probably ought to do this in another buffer - Ben */ - /* This really annoys me - Win95 (and not NT) spawn[vl]e don't like '/'! - Ben */ - for(s=r-filename ; *s ; ++s) - if(*s == '/') - *s='\\'; + /* FIXME: Probably ought to do this in another buffer - Ben + * This really annoys me - Win95 (and not NT) spawn[vl]e don't + * like '/'! - Ben */ + for (s = r-filename; *s; ++s) + if (*s == '/') + *s = '\\'; if ((!r-args) || (!r-args[0]) || (ind(r-args, '=') = 0)) { if (is_exe || is_binary) {
cvs commit: apachen/src/helpers TestCompile
jim 97/10/24 12:30:24 Modified:src/helpers TestCompile Log: Submitted by: Rasmus Lerdorf Reviewed by: Jim, Dean, Martin Have TestCompile run in the main ./src directory Revision ChangesPath 1.8 +2 -2 apachen/src/helpers/TestCompile Index: TestCompile === RCS file: /export/home/cvs/apachen/src/helpers/TestCompile,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- TestCompile 1997/10/15 20:32:02 1.7 +++ TestCompile 1997/10/24 19:30:23 1.8 @@ -102,10 +102,10 @@ LDFLAGS=\$(LDFLAGS1) \$(EXTRA_LDFLAGS) dummy: - \$(CC) \$(CFLAGS) \$(INCLUDES) \$(LDFLAGS) dummy.c -o dummy $TLIB \$(LIBS) + cd ..; \$(CC) \$(CFLAGS) \$(INCLUDES) \$(LDFLAGS) helpers/dummy.c -o helpers/dummy $TLIB \$(LIBS) testfunc: - \$(CC) \$(CFLAGS) \$(INCLUDES) \$(LDFLAGS) testfunc.c -o testfunc \$(LIBS) + cd ..; \$(CC) \$(CFLAGS) \$(INCLUDES) \$(LDFLAGS) helpers/testfunc.c -o helpers/testfunc \$(LIBS) EOF # Now run that Makefile
cvs commit: apachen/src Configure
jim 97/10/24 12:35:17 Modified:src Configure Log: Submitted by: Rasmus Lerdorf Reviewed by: Jim, Martin, Dean Since AddModule may want to muck around with RULE_WANTHSREGEX, move the handling of RULE_WANTHSREGEX down past AddModule Revision ChangesPath 1.162 +10 -9 apachen/src/Configure Index: Configure === RCS file: /export/home/cvs/apachen/src/Configure,v retrieving revision 1.161 retrieving revision 1.162 diff -u -r1.161 -r1.162 --- Configure 1997/10/21 06:41:07 1.161 +++ Configure 1997/10/24 19:35:16 1.162 @@ -667,15 +667,6 @@ esac # -# Now HS's POSIX regex implementation if needed/wanted -# -if [ $RULE_WANTHSREGEX = yes ]; then -REGLIB=regex/libregex.a -SUBDIRS=$SUBDIRS regex -INCLUDES_AUTODEPTH=$INCLUDES_AUTODEPTH regex -fi - -# # Now SOCKS4. # NOTE: We assume that if they are using SOCKS4, then they've # adjusted EXTRA_LIBS and/or EXTRA_LDFLAGS as required, @@ -829,6 +820,16 @@ done # $tmpfile now contains Module lines for all the modules we want + +# +# Now HS's POSIX regex implementation if needed/wanted. We do it +# now since AddModule may have changed it +# +if [ $RULE_WANTHSREGEX = yes ]; then +REGLIB=regex/libregex.a +SUBDIRS=$SUBDIRS regex +INCLUDES_AUTODEPTH=$INCLUDES_AUTODEPTH regex +fi # create modules.c