www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Taso Devetzis <devet...@snet.net>
Subject config/240: Add tuning directive ListenBacklog
Date Tue, 18 Mar 1997 07:20:02 GMT

>Number:         240
>Category:       config
>Synopsis:       Add tuning directive ListenBacklog
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apache (Apache HTTP Project)
>State:          open
>Class:          change-request
>Submitter-Id:   apache
>Arrival-Date:   Mon Mar 17 23:20:01 1997
>Originator:     devetzis@snet.net
>Organization:
apache
>Release:        all
>Environment:
n/a
>Description:
ListenBacklog complements SendBufferSize and the *KeepAlive* directives
for tuning the server relative to the kernel.  given the disparate networks
(and associated syn/ack tcp rtts, network path lengths, latencies, etc.) on
which one might deploy apache, this parameter is important enough to be runtime
configurable, imho.  for example, setting it an order of magnitude higher than
the current default is possible (and desirable -- think syn flood attacks) in
some kernels.

hmmm... did someone say mod_tune?
>How-To-Repeat:
n/a
>Fix:
patch for 1.2b7:

Common subdirectories: ../../apache_1.2b7/src/helpers and ./helpers
diff -c ../../apache_1.2b7/src/http_config.c ./http_config.c
*** ../../apache_1.2b7/src/http_config.c        Sat Jan 25 20:15:11 1997
--- ./http_config.c     Tue Mar 18 01:11:38 1997
***************
*** 937,942 ****
--- 937,943 ----
      s->keep_alive_timeout = 0;
      s->keep_alive = -1;
      s->keep_alive_max = -1;
+     s->listen_backlog = -1;
      /* start the list of addreses */
      addrs = &s->addrs;
      while( hostname[0] ) {
***************
*** 1004,1009 ****
--- 1005,1013 ----

        if (virt->send_buffer_size == 0)
                virt->send_buffer_size = main_server->send_buffer_size;
+
+       if (virt->listen_backlog == -1)
+               virt->listen_backlog = main_server->listen_backlog;
      }
  }

***************
*** 1046,1051 ****
--- 1050,1056 ----
      s->keep_alive_timeout = DEFAULT_KEEPALIVE_TIMEOUT;
      s->keep_alive_max = DEFAULT_KEEPALIVE;
      s->keep_alive = 1;
+     s->listen_backlog = DEFAULT_LISTEN_BACKLOG;
      s->next = NULL;
      s->addrs = pcalloc(p, sizeof (server_addr_rec));
      s->addrs->host_addr.s_addr = htonl (INADDR_ANY); /* NOT virtual host;
diff -c ../../apache_1.2b7/src/http_core.c ./http_core.c
*** ../../apache_1.2b7/src/http_core.c  Mon Feb 17 05:46:06 1997
--- ./http_core.c       Tue Mar 18 01:07:16 1997
***************
*** 867,872 ****
--- 867,881 ----
      return NULL;
  }

+ const char *set_listen_backlog (cmd_parms *cmd, void *dummy, char *arg) {
+   int s = atoi (arg);
+   if (s < 0) {
+     return "ListenBacklog must be >= 0.";
+   }
+   cmd->server->listen_backlog = s;
+   return NULL;
+ }
+
  const char *set_user (cmd_parms *cmd, void *dummy, char *arg)
  {
      if (!cmd->server->is_virtual) {
***************
*** 1242,1247 ****
--- 1251,1257 ----
  { "Listen", set_listener, NULL, RSRC_CONF, TAKE1,
        "a port number or a numeric IP address and a port number"},
  { "SendBufferSize", set_send_buffer_size, NULL, RSRC_CONF, TAKE1, "send buffer
 size in bytes"},
+ { "ListenBacklog", set_listen_backlog, NULL, RSRC_CONF, TAKE1, "maximum queue
length for pending connections"},
  { "AddModule", add_module_command, NULL, RSRC_CONF, ITERATE,
    "the name of a module" },
  { "ClearModuleList", clear_module_list_command, NULL, RSRC_CONF, NO_ARGS, NULL
 },
diff -c ../../apache_1.2b7/src/http_main.c ./http_main.c
*** ../../apache_1.2b7/src/http_main.c  Wed Feb 19 22:20:18 1997
--- ./http_main.c       Tue Mar 18 01:15:39 1997
***************
*** 1937,1943 ****
  #ifdef MPE
      if (ntohs(server->sin_port) < 1024) GETUSERMODE();
  #endif
!     listen(s, 512);
      return s;
  }

--- 1937,1943 ----
  #ifdef MPE
      if (ntohs(server->sin_port) < 1024) GETUSERMODE();
  #endif
!     listen(s, server_conf->listen_backlog);
      return s;
  }

diff -c ../../apache_1.2b7/src/httpd.h ./httpd.h
*** ../../apache_1.2b7/src/httpd.h      Fri Feb 21 19:38:04 1997
--- ./httpd.h   Tue Mar 18 01:13:10 1997
***************
*** 189,194 ****
--- 189,197 ----
  /* The number of requests to entertain per connection */
  #define DEFAULT_KEEPALIVE 100

+ /* The maximum length of the pending connection queue */
+ #define DEFAULT_LISTEN_BACKLOG 512
+
  /* The size of the server's internal read-write buffers */
  #define IOBUFSIZE 8192

***************
*** 597,602 ****
--- 600,606 ----
      int keep_alive_max;               /* Maximum requests per connection */
      int keep_alive;           /* Use persistent connections? */
      int send_buffer_size;       /* size of TCP send buffer (in bytes) */
+     int listen_backlog;               /* size of TCP backlog queue */

      char *path;                       /* Pathname for ServerPath */
      int pathlen;              /* Length of path */
Common subdirectories: ../../apache_1.2b7/src/modules and ./modules
Common subdirectories: ../../apache_1.2b7/src/regex and ./regex
%0
>Audit-Trail:
>Unformatted:



Mime
View raw message