You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by st...@apache.org on 2002/07/04 17:20:54 UTC

cvs commit: httpd-2.0/server/mpm/worker mpm.h worker.c

striker     2002/07/04 08:20:54

  Modified:    .        CHANGES
               server   core.c mpm_common.c
               server/mpm/beos beos.c mpm.h
               server/mpm/experimental/leader leader.c mpm.h
               server/mpm/experimental/threadpool mpm.h threadpool.c
               server/mpm/netware mpm.h mpm_netware.c
               server/mpm/prefork mpm.h prefork.c
               server/mpm/worker mpm.h worker.c
  Log:
  Add a new directive: MaxMemFree.  MaxMemFree makes it possible
  to configure the maximum amount of memory the allocators will
  hold on to for reuse.  Anything over the MaxMemFree threshold
  will be free()d.  This directive is usefull when uncommon large
  peaks occur in memory usage.  It should _not_ be used to mask
  defective modules' memory use.
  
  Revision  Changes    Path
  1.857     +6 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.856
  retrieving revision 1.857
  diff -u -r1.856 -r1.857
  --- CHANGES	2 Jul 2002 23:54:07 -0000	1.856
  +++ CHANGES	4 Jul 2002 15:20:52 -0000	1.857
  @@ -1,4 +1,10 @@
   Changes with Apache 2.0.40
  +  *) Add a new directive: MaxMemFree.  MaxMemFree makes it possible
  +     to configure the maximum amount of memory the allocators will
  +     hold on to for reuse.  Anything over the MaxMemFree threshold
  +     will be free()d.  This directive is usefull when uncommon large
  +     peaks occur in memory usage.  It should _not_ be used to mask
  +     defective modules' memory use.  [Sander Striker]
   
     *) Fixed the Content-Length filter so that HTTP/1.0 requests to CGI
        scripts would not result in a truncated response.
  
  
  
  1.191     +4 -0      httpd-2.0/server/core.c
  
  Index: core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/core.c,v
  retrieving revision 1.190
  retrieving revision 1.191
  diff -u -r1.190 -r1.191
  --- core.c	2 Jul 2002 21:40:13 -0000	1.190
  +++ core.c	4 Jul 2002 15:20:52 -0000	1.191
  @@ -3043,6 +3043,10 @@
   AP_INIT_TAKE1("AcceptMutex", ap_mpm_set_accept_lock_mech, NULL, RSRC_CONF, \
                 ap_valid_accept_mutex_string),
   #endif
  +#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
  +AP_INIT_TAKE1("MaxMemFree", ap_mpm_set_max_mem_free, NULL, RSRC_CONF,\
  +              "Maximum number of 1k blocks a particular childs allocator may hold."),
  +#endif
   { NULL }
   };
   
  
  
  
  1.99      +23 -0     httpd-2.0/server/mpm_common.c
  
  Index: mpm_common.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm_common.c,v
  retrieving revision 1.98
  retrieving revision 1.99
  diff -u -r1.98 -r1.99
  --- mpm_common.c	9 Jun 2002 03:44:03 -0000	1.98
  +++ mpm_common.c	4 Jul 2002 15:20:52 -0000	1.99
  @@ -880,3 +880,26 @@
   
   #endif /* AP_MPM_WANT_SIGNAL_SERVER */
   
  +#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
  +apr_uint32_t ap_max_mem_free = 0;
  +
  +const char *ap_mpm_set_max_mem_free(cmd_parms *cmd, void *dummy,
  +	                            const char *arg)
  +{
  +    long value;
  +    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
  +    if (err != NULL) {
  +        return err;
  +    }
  +    
  +    value = strtol(arg, NULL, 0);
  +    if (value < 0 || errno == ERANGE)
  +        return apr_pstrcat(cmd->pool, "Invalid MaxMemFree value: ", 
  +                           arg, NULL);
  +
  +    ap_max_mem_free = (apr_uint32_t)value * 1024;
  +
  +    return NULL;
  +}
  +
  +#endif /* AP_MPM_WANT_SET_MAX_MEM_FREE */
  
  
  
  1.97      +1 -0      httpd-2.0/server/mpm/beos/beos.c
  
  Index: beos.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/beos/beos.c,v
  retrieving revision 1.96
  retrieving revision 1.97
  diff -u -r1.96 -r1.97
  --- beos.c	30 May 2002 00:21:27 -0000	1.96
  +++ beos.c	4 Jul 2002 15:20:52 -0000	1.97
  @@ -383,6 +383,7 @@
       sigprocmask(SIG_BLOCK, &sig_mask, NULL);
   
       apr_allocator_create(&allocator);
  +    apr_allocator_max_free_set(allocator, ap_max_mem_free);
       apr_pool_create_ex(&ptrans, tpool, NULL, allocator);
       apr_allocator_owner_set(allocator, ptrans);
   
  
  
  
  1.14      +1 -0      httpd-2.0/server/mpm/beos/mpm.h
  
  Index: mpm.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/beos/mpm.h,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- mpm.h	29 Mar 2002 16:15:33 -0000	1.13
  +++ mpm.h	4 Jul 2002 15:20:53 -0000	1.14
  @@ -73,6 +73,7 @@
   #define AP_MPM_WANT_SET_SCOREBOARD
   #define AP_MPM_WANT_SET_MAX_REQUESTS
   #define AP_MPM_WANT_SET_COREDUMPDIR
  +#define AP_MPM_WANT_SET_MAX_MEM_FREE
   
   extern int ap_max_child_assigned;
   extern server_rec *ap_server_conf;
  
  
  
  1.22      +1 -0      httpd-2.0/server/mpm/experimental/leader/leader.c
  
  Index: leader.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/experimental/leader/leader.c,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- leader.c	7 Jun 2002 14:08:04 -0000	1.21
  +++ leader.c	4 Jul 2002 15:20:53 -0000	1.22
  @@ -821,6 +821,7 @@
       free(ti);
   
       apr_allocator_create(&allocator);
  +    apr_allocator_max_free_set(allocator, ap_max_mem_free);
       apr_pool_create_ex(&ptrans, NULL, NULL, allocator);
       apr_allocator_owner_set(allocator, ptrans);
       bucket_alloc = apr_bucket_alloc_create(tpool);
  
  
  
  1.5       +1 -0      httpd-2.0/server/mpm/experimental/leader/mpm.h
  
  Index: mpm.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/experimental/leader/mpm.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- mpm.h	22 May 2002 01:04:59 -0000	1.4
  +++ mpm.h	4 Jul 2002 15:20:53 -0000	1.5
  @@ -74,6 +74,7 @@
   #define AP_MPM_WANT_SET_MAX_REQUESTS
   #define AP_MPM_WANT_SET_COREDUMPDIR
   #define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
  +#define AP_MPM_WANT_SET_MAX_MEM_FREE
   #define AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK
   
   #define AP_MPM_USES_POD 1
  
  
  
  1.3       +1 -0      httpd-2.0/server/mpm/experimental/threadpool/mpm.h
  
  Index: mpm.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/experimental/threadpool/mpm.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- mpm.h	6 Jun 2002 23:58:14 -0000	1.2
  +++ mpm.h	4 Jul 2002 15:20:53 -0000	1.3
  @@ -75,6 +75,7 @@
   #define AP_MPM_WANT_SET_COREDUMPDIR
   #define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
   #define AP_MPM_WANT_SIGNAL_SERVER
  +#define AP_MPM_WANT_SET_MAX_MEM_FREE
   #define AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK
   
   #define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid)
  
  
  
  1.12      +1 -0      httpd-2.0/server/mpm/experimental/threadpool/threadpool.c
  
  Index: threadpool.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/experimental/threadpool/threadpool.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- threadpool.c	7 Jun 2002 14:08:04 -0000	1.11
  +++ threadpool.c	4 Jul 2002 15:20:53 -0000	1.12
  @@ -1045,6 +1045,7 @@
       ap_update_child_status_from_indexes(process_slot, thread_slot, SERVER_STARTING, NULL);
   
       apr_allocator_create(&allocator);
  +    apr_allocator_max_free_set(allocator, ap_max_mem_free);
       apr_pool_create_ex(&ptrans, NULL, NULL, allocator);
       apr_allocator_owner_set(allocator, ptrans);
   
  
  
  
  1.6       +1 -0      httpd-2.0/server/mpm/netware/mpm.h
  
  Index: mpm.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/netware/mpm.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- mpm.h	29 Mar 2002 16:15:33 -0000	1.5
  +++ mpm.h	4 Jul 2002 15:20:54 -0000	1.6
  @@ -72,6 +72,7 @@
     #define AP_MPM_WANT_SET_LOCKFILE 
   */
   #define AP_MPM_WANT_SET_MAX_REQUESTS
  +#define AP_MPM_WANT_SET_MAX_MEM_FREE
   #define AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK
   /*#define AP_MPM_WANT_SET_COREDUMPDIR
     #define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH 
  
  
  
  1.56      +1 -0      httpd-2.0/server/mpm/netware/mpm_netware.c
  
  Index: mpm_netware.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/netware/mpm_netware.c,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- mpm_netware.c	26 Jun 2002 21:53:25 -0000	1.55
  +++ mpm_netware.c	4 Jul 2002 15:20:54 -0000	1.56
  @@ -373,6 +373,7 @@
       tv.tv_usec = 0;
   
       apr_allocator_create(&allocator);
  +    apr_allocator_max_free_set(allocator, ap_max_mem_free);
       apr_pool_create_ex(&ptrans, NULL, NULL, allocator);
       apr_allocator_owner_set(allocator, ptrans);
       apr_pool_tag(ptrans, "transaction");
  
  
  
  1.21      +1 -0      httpd-2.0/server/mpm/prefork/mpm.h
  
  Index: mpm.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/prefork/mpm.h,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- mpm.h	23 May 2002 12:58:37 -0000	1.20
  +++ mpm.h	4 Jul 2002 15:20:54 -0000	1.21
  @@ -78,6 +78,7 @@
   #define AP_MPM_WANT_SET_COREDUMPDIR
   #define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
   #define AP_MPM_WANT_SIGNAL_SERVER
  +#define AP_MPM_WANT_SET_MAX_MEM_FREE
   #define AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK
   
   #define AP_MPM_USES_POD 1
  
  
  
  1.268     +1 -0      httpd-2.0/server/mpm/prefork/prefork.c
  
  Index: prefork.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/prefork/prefork.c,v
  retrieving revision 1.267
  retrieving revision 1.268
  diff -u -r1.267 -r1.268
  --- prefork.c	14 Jun 2002 03:11:43 -0000	1.267
  +++ prefork.c	4 Jul 2002 15:20:54 -0000	1.268
  @@ -558,6 +558,7 @@
        * we can have cleanups occur when the child exits.
        */
       apr_allocator_create(&allocator);
  +    apr_allocator_max_free_set(allocator, ap_max_mem_free);
       apr_pool_create_ex(&pchild, pconf, NULL, allocator);
       apr_allocator_owner_set(allocator, pchild);
   
  
  
  
  1.14      +1 -0      httpd-2.0/server/mpm/worker/mpm.h
  
  Index: mpm.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/worker/mpm.h,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- mpm.h	23 May 2002 12:58:37 -0000	1.13
  +++ mpm.h	4 Jul 2002 15:20:54 -0000	1.14
  @@ -75,6 +75,7 @@
   #define AP_MPM_WANT_SET_COREDUMPDIR
   #define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
   #define AP_MPM_WANT_SIGNAL_SERVER
  +#define AP_MPM_WANT_SET_MAX_MEM_FREE
   #define AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK
   
   #define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid)
  
  
  
  1.129     +1 -0      httpd-2.0/server/mpm/worker/worker.c
  
  Index: worker.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/worker/worker.c,v
  retrieving revision 1.128
  retrieving revision 1.129
  diff -u -r1.128 -r1.129
  --- worker.c	7 Jun 2002 14:08:05 -0000	1.128
  +++ worker.c	4 Jul 2002 15:20:54 -0000	1.129
  @@ -796,6 +796,7 @@
                   apr_allocator_t *allocator;
   
                   apr_allocator_create(&allocator);
  +                apr_allocator_max_free_set(allocator, ap_max_mem_free);
                   apr_pool_create_ex(&ptrans, NULL, NULL, allocator);
                   apr_allocator_owner_set(allocator, ptrans);
               }
  
  
  

Re: cvs commit: httpd-2.0/server/mpm/worker mpm.h worker.c

Posted by Dale Ghent <da...@elemental.org>.
On 4 Jul 2002 striker@apache.org wrote:

| striker     2002/07/04 08:20:54
|
|   Modified:    .        CHANGES
|                server   core.c mpm_common.c
|                server/mpm/beos beos.c mpm.h
|                server/mpm/experimental/leader leader.c mpm.h
|                server/mpm/experimental/threadpool mpm.h threadpool.c
|                server/mpm/netware mpm.h mpm_netware.c
|                server/mpm/prefork mpm.h prefork.c
|                server/mpm/worker mpm.h worker.c
|   Log:
|   Add a new directive: MaxMemFree.  MaxMemFree makes it possible
|   to configure the maximum amount of memory the allocators will
|   hold on to for reuse.  Anything over the MaxMemFree threshold
|   will be free()d.  This directive is usefull when uncommon large
|   peaks occur in memory usage.  It should _not_ be used to mask
|   defective modules' memory use.

Shouldnt this directive be more like "MaxMemAlloc"?

"MaxMemFree" makes me think of "The maximum amount of free memory on the
system" which this is clearly not it's intended setting... it's the
opposite.

/dale