rbb         99/02/11 08:33:05

  Modified:    pthreads/src/include http_conf_globals.h httpd.h
               pthreads/src/main http_config.c http_core.c http_main.c
  Log:
  Basic cleanup to forking logic.  Makes it more extenisble by the user.
  
  Revision  Changes    Path
  1.5       +2 -1      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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- http_conf_globals.h       1999/02/10 21:06:51     1.4
  +++ http_conf_globals.h       1999/02/11 16:33:00     1.5
  @@ -74,7 +74,8 @@
   extern gid_t group_id_list[NGROUPS_MAX];
   #endif
   extern int ap_threads_per_child;
  -extern int ap_min_idle_threads;
  +extern int ap_idle_thread_threshold;
  +extern int ap_busy_thread_threshold;
   extern int ap_max_requests_per_child;
   extern int ap_excess_requests_per_child;
   extern struct in_addr ap_bind_address;
  
  
  
  1.6       +9 -0      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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- httpd.h   1999/02/09 21:39:52     1.5
  +++ httpd.h   1999/02/11 16:33:00     1.6
  @@ -369,6 +369,15 @@
   #ifndef DEFAULT_THREADS_PER_CHILD
   #define DEFAULT_THREADS_PER_CHILD 50
   #endif
  +
  +#ifndef DEFAULT_IDLE_THRESHOLD
  +#define DEFAULT_IDLE_THRESHOLD (int)(DEFAULT_THREADS_PER_CHILD * 0.05)
  +#endif
  +
  +#ifndef DEFAULT_BUSY_THRESHOLD
  +#define DEFAULT_BUSY_THRESHOLD (DEFAULT_THREADS_PER_CHILD - 
(int)(DEFAULT_THREADS_PER_CHILD * 0.05))
  +#endif
  +
   #ifndef DEFAULT_EXCESS_REQUESTS_PER_CHILD
   #define DEFAULT_EXCESS_REQUESTS_PER_CHILD 0
   #endif
  
  
  
  1.7       +2 -1      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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- http_config.c     1999/02/10 21:06:52     1.6
  +++ http_config.c     1999/02/11 16:33:04     1.7
  @@ -1388,7 +1388,8 @@
       ap_lock_fname = DEFAULT_LOCKFILE;
       ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
       ap_threads_per_child = DEFAULT_THREADS_PER_CHILD;
  -    ap_min_idle_threads = (int)(ap_threads_per_child * 0.05);
  +    ap_idle_thread_threshold = DEFAULT_IDLE_THRESHOLD;
  +    ap_busy_thread_threshold = DEFAULT_BUSY_THRESHOLD;
       /* ZZZ  Initialize the Network Address here. */
       ap_bind_address.s_addr = htonl(INADDR_ANY);
       ap_listeners = NULL;
  
  
  
  1.6       +36 -1     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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- http_core.c       1999/02/10 21:06:52     1.5
  +++ http_core.c       1999/02/11 16:33:04     1.6
  @@ -2149,6 +2149,27 @@
          
       return NULL;
   }
  +static const char *set_idle_threshold(cmd_parms *cmd, void *dummy, char *arg)
  +{
  +    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
  +    if (err != NULL) {
  +        return err;
  +    }
  +
  +    ap_idle_thread_threshold = atoi(arg);
  +    return NULL;
  +}
  +
  +static const char *set_busy_threshold(cmd_parms *cmd, void *dummy, char *arg)
  +{
  +    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
  +    if (err != NULL) {
  +        return err;
  +    }
  +
  +    ap_busy_thread_threshold = atoi(arg);
  +    return NULL;
  +}
   
   static const char *set_max_free_servers(cmd_parms *cmd, void *dummy, char 
*arg)
   {
  @@ -2197,13 +2218,23 @@
   }
   
   static const char *set_threads(cmd_parms *cmd, void *dummy, char *arg) {
  +    int user_def_idle = ap_idle_thread_threshold;
  +    int user_def_busy = ap_busy_thread_threshold;
       const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
       if (err != NULL) {
           return err;
       }
   
       ap_threads_per_child = atoi(arg);
  -    ap_min_idle_threads = (int)(ap_threads_per_child * 0.05);
  +
  +    ap_idle_thread_threshold = (int)(ap_threads_per_child * 0.05);
  +    ap_busy_thread_threshold = ap_threads_per_child - 
(int)(ap_threads_per_child * 0.05);
  +
  +    if (user_def_idle != DEFAULT_IDLE_THRESHOLD)
  +        ap_idle_thread_threshold = user_def_idle;
  +    if (user_def_busy != DEFAULT_BUSY_THRESHOLD)
  +        ap_busy_thread_threshold = user_def_busy;
  +
       if (ap_threads_per_child < 1) {
        fprintf(stderr, "WARNING: Require ThreadsPerChild > 0, setting to 1\n");
        ap_threads_per_child = 1;
  @@ -2807,6 +2838,10 @@
     "Maximum number of idle children" },
   { "MaxServers", set_max_free_servers, NULL, RSRC_CONF, TAKE1,
     "Deprecated equivalent to MaxSpareServers" },
  +{ "IdleThreadThreshold", set_idle_threshold, NULL, RSRC_CONF, TAKE1,
  +  "Minimum number of idle threads, below which process is considered ready 
for reaping." },
  +{ "BusyThreadThreshold", set_busy_threshold, NULL, RSRC_CONF, TAKE1,
  +  "Maximum number of idle threads, above which process is considered busy." 
},
   { "ServersSafetyLimit", set_server_limit, NULL, RSRC_CONF, TAKE1,
     "Deprecated equivalent to MaxClients" },
   { "MaxClients", set_server_limit, NULL, RSRC_CONF, TAKE1,
  
  
  
  1.16      +3 -2      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.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- http_main.c       1999/02/10 21:06:53     1.15
  +++ http_main.c       1999/02/11 16:33:04     1.16
  @@ -158,7 +158,8 @@
   #endif
   int ap_threads_per_child;
   int ap_max_requests_per_child;
  -int ap_min_idle_threads;
  +int ap_idle_thread_threshold;
  +int ap_busy_thread_threshold;
   int ap_excess_requests_per_child;
   char *ap_pid_fname;
   char *ap_scoreboard_fname;
  @@ -2474,7 +2475,7 @@
                }
            }
        }
  -     if (idle_thread_count <= ap_min_idle_threads) {
  +     if (idle_thread_count <= ap_idle_thread_threshold) {
            idle_count++;
            to_kill = i;
        }
  
  
  

Reply via email to