brian 96/11/04 10:10:07
Modified: src http_config.c http_core.c http_main.c httpd.h
Log:
Reviewed by: Brian Behlendorf
Submitted by: [EMAIL PROTECTED]
Added a SendBufferSize directive to the core, which allows one to adjust
the TCP buffer sizes to optimize for high-bandwidth, high-latency transfers
of large files.
Revision Changes Path
1.32 +3 -0 apache/src/http_config.c
Index: http_config.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_config.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -C3 -r1.31 -r1.32
*** http_config.c 1996/11/04 00:55:17 1.31
--- http_config.c 1996/11/04 18:09:55 1.32
***************
*** 971,976 ****
--- 971,979 ----
if (virt->keep_alive == -1)
virt->keep_alive = main_server->keep_alive;
+
+ if (virt->send_buffer_size == 0)
+ virt->send_buffer_size = main_server->send_buffer_size;
}
}
1.44 +10 -0 apache/src/http_core.c
Index: http_core.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_core.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -C3 -r1.43 -r1.44
*** http_core.c 1996/11/04 09:43:07 1.43
--- http_core.c 1996/11/04 18:09:58 1.44
***************
*** 812,817 ****
--- 812,826 ----
return NULL;
}
+ const char *set_send_buffer_size (cmd_parms *cmd, void *dummy, char *arg) {
+ int s = atoi (arg);
+ if (s < 512 && s != 0) {
+ return "SendBufferSize must be >= 512 bytes, or 0 for system
default.";
+ }
+ cmd->server->send_buffer_size = s;
+ return NULL;
+ }
+
const char *set_user (cmd_parms *cmd, void *dummy, char *arg)
{
uid_t uid;
***************
*** 1163,1168 ****
--- 1172,1178 ----
"'*', a numeric IP address, or the name of a host with a unique IP
address"},
{ "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"},
{ "<VirtualHost", virtualhost_section, NULL, RSRC_CONF, RAW_ARGS, NULL },
{ "</VirtualHost>", end_virtualhost_section, NULL, RSRC_CONF, NO_ARGS, NULL
},
{ "AddModule", add_module_command, NULL, RSRC_CONF, ITERATE,
1.85 +27 -0 apache/src/http_main.c
Index: http_main.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_main.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -C3 -r1.84 -r1.85
*** http_main.c 1996/11/04 00:55:19 1.84
--- http_main.c 1996/11/04 18:09:59 1.85
***************
*** 1658,1663 ****
--- 1658,1690 ----
}
#endif /* USE_SO_LINGER */
+ /*
+ * To send data over high bandwidth-delay connections at full
+ * speed we must the TCP window to open wide enough to keep the
+ * pipe full. Default the default window size on many systems
+ * is only 4kB. Cross-country WAN connections of 100ms
+ * at 1Mb/s are not impossible for well connected sites in 1995.
+ * If we assume 100ms cross-country latency,
+ * a 4kB buffer limits throughput to 40kB/s.
+ *
+ * To avoid this problem I've added the SendBufferSize directive
+ * to allow the web master to configure send buffer size.
+ *
+ * The trade-off of larger buffers is that more kernel memory
+ * is consumed. YMMV, know your customers and your network!
+ *
+ * -John Heidemann <[EMAIL PROTECTED]> 25-Oct-96
+ *
+ *
+ * If no size is specified, use the kernel default.
+ */
+ if (server_conf->send_buffer_size) {
+ if((setsockopt(s, SOL_SOCKET, SO_SNDBUF,
(char*)&server_conf->send_buffer_size, sizeof(int))) < 0) {
+ perror("setsockopt(SO_SNDBUF), using default buffer size");
+ /* Fail soft. */
+ }
+ }
+
if(bind(s, (struct sockaddr *)server,sizeof(struct sockaddr_in)) == -1)
{
perror("bind");
1.60 +1 -0 apache/src/httpd.h
Index: httpd.h
===================================================================
RCS file: /export/home/cvs/apache/src/httpd.h,v
retrieving revision 1.59
retrieving revision 1.60
diff -C3 -r1.59 -r1.60
*** httpd.h 1996/11/04 01:19:16 1.59
--- httpd.h 1996/11/04 18:10:02 1.60
***************
*** 570,575 ****
--- 570,576 ----
int timeout; /* Timeout, in seconds, before we give up */
int keep_alive_timeout; /* Seconds we'll wait for another request */
int keep_alive; /* Maximum requests per connection */
+ int send_buffer_size; /* size of TCP send buffer (in bytes) */
char *path; /* Pathname for ServerPath */
int pathlen; /* Length of path */