rbb 99/02/05 12:17:24
Modified: pthreads/src/include http_conf_globals.h httpd.h pthreads/src/main http_config.c http_core.c http_main.c Log: Start the server with sensible defaults. 10000 requests per child and 50 threads per child. I also fixed size of the fd queue to be the number of threads in the process. Revision Changes Path 1.2 +1 -0 apache-apr/pthreads/src/include/http_conf_globals.h Index: http_conf_globals.h =================================================================== RCS file: /home/cvs/apache-apr/pthreads/src/include/http_conf_globals.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- http_conf_globals.h 1999/01/21 23:08:32 1.1 +++ http_conf_globals.h 1999/02/05 20:17:17 1.2 @@ -74,6 +74,7 @@ extern gid_t group_id_list[NGROUPS_MAX]; #endif extern int ap_threads_per_child; +extern int ap_max_requests_per_child; extern int ap_excess_requests_per_child; extern struct in_addr ap_bind_address; extern listen_rec *ap_listeners; 1.3 +1 -1 apache-apr/pthreads/src/include/httpd.h Index: httpd.h =================================================================== RCS file: /home/cvs/apache-apr/pthreads/src/include/httpd.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- httpd.h 1999/01/28 21:55:20 1.2 +++ httpd.h 1999/02/05 20:17:17 1.3 @@ -349,7 +349,7 @@ */ #ifndef DEFAULT_MAX_REQUESTS_PER_CHILD -#define DEFAULT_MAX_REQUESTS_PER_CHILD 0 +#define DEFAULT_MAX_REQUESTS_PER_CHILD 10000 #endif #ifndef DEFAULT_THREADS_PER_CHILD 1.4 +2 -0 apache-apr/pthreads/src/main/http_config.c Index: http_config.c =================================================================== RCS file: /home/cvs/apache-apr/pthreads/src/main/http_config.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- http_config.c 1999/02/04 06:52:38 1.3 +++ http_config.c 1999/02/05 20:17:18 1.4 @@ -1386,6 +1386,8 @@ ap_pid_fname = DEFAULT_PIDLOG; ap_scoreboard_fname = DEFAULT_SCOREBOARD; ap_lock_fname = DEFAULT_LOCKFILE; + ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD; + ap_threads_per_child = DEFAULT_THREADS_PER_CHILD; /* ZZZ Initialize the Network Address here. */ ap_bind_address.s_addr = htonl(INADDR_ANY); ap_listeners = NULL; 1.2 +8 -2 apache-apr/pthreads/src/main/http_core.c Index: http_core.c =================================================================== RCS file: /home/cvs/apache-apr/pthreads/src/main/http_core.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- http_core.c 1999/01/21 23:08:33 1.1 +++ http_core.c 1999/02/05 20:17:19 1.2 @@ -2014,6 +2014,8 @@ return err; } + ap_max_requests_per_child = atoi(arg); + return NULL; } @@ -2024,7 +2026,11 @@ } ap_threads_per_child = atoi(arg); - if (ap_threads_per_child > HARD_SERVER_LIMIT) { + if (ap_threads_per_child < 1) { + fprintf(stderr, "WARNING: Require ThreadsPerChild > 0, setting to 1\n"); + ap_threads_per_child = 1; + } + /* if (ap_threads_per_child > HARD_SERVER_LIMIT) { fprintf(stderr, "WARNING: ThreadsPerChild of %d exceeds compile time limit " "of %d threads,\n", ap_threads_per_child, HARD_SERVER_LIMIT); fprintf(stderr, " lowering ThreadsPerChild to %d. To increase, please " @@ -2036,7 +2042,7 @@ fprintf(stderr, "WARNING: Require ThreadsPerChild > 0, setting to 1\n"); ap_threads_per_child = 1; } - + */ return NULL; } 1.7 +5 -5 apache-apr/pthreads/src/main/http_main.c Index: http_main.c =================================================================== RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- http_main.c 1999/02/03 18:29:29 1.6 +++ http_main.c 1999/02/05 20:17:20 1.7 @@ -156,7 +156,8 @@ #ifdef MULTIPLE_GROUPS gid_t group_id_list[NGROUPS_MAX]; #endif -int ap_threads_per_child = 5; /* Need to require this directive, or make a valid default */ +int ap_threads_per_child; +int ap_max_requests_per_child; int ap_excess_requests_per_child; char *ap_pid_fname; char *ap_scoreboard_fname; @@ -242,6 +243,7 @@ static server_rec *server_conf; static struct pollfd *listenfds; /* ZZZZZ abstract fd_set */ static int num_listenfds; /* ZZZZZ abstract num_listenfds */ +static pid_t pgrp; /* one_process --- debugging mode variable; can be set from the command line * with the -X flag. If set, this gets you the child_main loop running @@ -1542,7 +1544,7 @@ process_socket(pchild, &sa_client, csd, my_pid); } } - + static void set_group_privs(void) { #ifndef WIN32 @@ -1626,7 +1628,7 @@ /*done with init critical section */ - queue_init(&csd_queue, 2); + queue_init(&csd_queue, ap_threads_per_child); /* Setup worker threads */ @@ -2041,9 +2043,7 @@ is_graceful = 0; if (!one_process) { -#if 0 detach(); -#endif } else { MONCONTROL(1);