You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by yl...@apache.org on 2020/12/11 11:33:00 UTC
svn commit: r1884304 - in /httpd/httpd/trunk: docs/manual/mod/core.xml
server/core.c server/core_filters.c server/util_filter.c
Author: ylavic
Date: Fri Dec 11 11:33:00 2020
New Revision: 1884304
URL: http://svn.apache.org/viewvc?rev=1884304&view=rev
Log:
Follow up to r1836032: better flush limits checks and description.
Modified:
httpd/httpd/trunk/docs/manual/mod/core.xml
httpd/httpd/trunk/server/core.c
httpd/httpd/trunk/server/core_filters.c
httpd/httpd/trunk/server/util_filter.c
Modified: httpd/httpd/trunk/docs/manual/mod/core.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/core.xml?rev=1884304&r1=1884303&r2=1884304&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/core.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/core.xml Fri Dec 11 11:33:00 2020
@@ -2031,21 +2031,24 @@ filenames</description>
<directivesynopsis>
<name>FlushMaxPipelined</name>
-<description>Threshold above which pipelined responses are flushed to the
-network</description>
+<description>Maximum number of pipelined responses above which they are flushed
+to the network</description>
<syntax>FlushMaxPipelined <var>number</var></syntax>
<default>FlushMaxPipelined 5</default>
<contextlist><context>server config</context><context>virtual host</context>
-<context>directory</context></contextlist>
+</contextlist>
<compatibility>2.5 and later</compatibility>
<usage>
- <p>This directive allows to configure the threshold for pipelined
- responses, which remain pending so long as pipelined request are handled.
- When this limit is reached, are forcibly flushed to the network in blocking
- mode, until passing under the threshold again.</p>
-
- <p>This threshold helps maintaning constrained memory usage.</p>
+ <p>This directive allows to configure the maximum number of pipelined
+ responses, which remain pending so long as pipelined request are received.
+ When the limit is reached, reponses are forcibly flushed to the network in
+ blocking mode, until passing under the limit again.</p>
+
+ <p><directive>FlushMaxPipelined</directive> helps constraining memory
+ usage. When set to <var>0</var> pipelining is disabled, when set to
+ <var>-1</var> there is no limit (<directive>FlushMaxThreshold</directive>
+ still applies).</p>
</usage>
</directivesynopsis>
@@ -2056,15 +2059,19 @@ network</description>
<syntax>FlushMaxThreshold<var>number-of-bytes</var></syntax>
<default>FlushMaxThreshold 65536</default>
<contextlist><context>server config</context><context>virtual host</context>
-<context>directory</context></contextlist>
+</contextlist>
<compatibility>2.5 and later</compatibility>
<usage>
- <p>This directive allows to configure the threshold (in bytes) for pending
- output data. When this limit is reached, data are forcibly flushed to the
- network in blocking mode, until passing under the threshold again.</p>
-
- <p>This threshold helps maintaning constrained memory usage.</p>
+ <p>This directive allows to configure the threshold for pending output
+ data (in bytes). When the limit is reached, data are forcibly flushed to
+ the network in blocking mode, until passing under the limit again.</p>
+
+ <p><directive>FlushMaxThreshold</directive> helps constraining memory
+ usage. When set to <var>0</var> or a too small value there are actually
+ no pending data, but for threaded MPMs there can be more threads busy
+ waiting for the network thus less ones available to handle the other
+ simultaneous connections.</p>
</usage>
</directivesynopsis>
@@ -4179,19 +4186,20 @@ Protocols h2 http/1.1
<directivesynopsis>
<name>ReadBufferSize</name>
-<description>Size of the buffers used to read network data</description>
-<syntax>ReadBufferSize <var>number-of-bytes</var></syntax>
+<description>Size of the buffers used to read data</description>
+<syntax>ReadBufferSize <var>bytes</var></syntax>
<default>ReadBufferSize 8192</default>
<contextlist><context>server config</context><context>virtual host</context>
<context>directory</context></contextlist>
<compatibility>2.5 and later</compatibility>
<usage>
- <p>This directive allows to configure the size in bytes of the memory
- buffers used to read data from the network.</p>
+ <p>This directive allows to configure the size (in bytes) of the memory
+ buffer used to read data from the network or files.</p>
- <p>Larger buffer can increase peformances for large data but consume more
- memory (per connection).</p>
+ <p>A larger buffer can increase peformances with larger data, but consumes
+ more memory per connection. The minimum configurable size is
+ <var>1024</var>.</p>
</usage>
</directivesynopsis>
Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=1884304&r1=1884303&r2=1884304&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Fri Dec 11 11:33:00 2020
@@ -83,8 +83,8 @@
/* valid in core-conf, but not in runtime r->used_path_info */
#define AP_ACCEPT_PATHINFO_UNSET 3
-#define AP_FLUSH_MAX_THRESHOLD 65536
-#define AP_FLUSH_MAX_PIPELINED 5
+#define AP_FLUSH_MAX_THRESHOLD 65535
+#define AP_FLUSH_MAX_PIPELINED 4
APR_HOOK_STRUCT(
APR_HOOK_LINK(get_mgmt_items)
@@ -2344,10 +2344,10 @@ static const char *set_read_buf_size(cmd
char *end;
if (apr_strtoff(&size, arg, &end, 10)
- || size < 0 || size > APR_SIZE_MAX || *end)
+ || *end || size < 0 || size > APR_UINT32_MAX)
return apr_pstrcat(cmd->pool,
"parameter must be a number between 0 and "
- APR_STRINGIFY(APR_SIZE_MAX) "): ",
+ APR_STRINGIFY(APR_UINT32_MAX) "): ",
arg, NULL);
d->read_buf_size = (apr_size_t)size;
@@ -2364,10 +2364,10 @@ static const char *set_flush_max_thresho
char *end;
if (apr_strtoff(&size, arg, &end, 10)
- || size <= 0 || size > APR_SIZE_MAX || *end)
+ || *end || size < 0 || size > APR_UINT32_MAX)
return apr_pstrcat(cmd->pool,
- "parameter must be a number between 1 and "
- APR_STRINGIFY(APR_SIZE_MAX) "): ",
+ "parameter must be a number between 0 and "
+ APR_STRINGIFY(APR_UINT32_MAX) "): ",
arg, NULL);
conf->flush_max_threshold = (apr_size_t)size;
@@ -2384,9 +2384,9 @@ static const char *set_flush_max_pipelin
char *end;
if (apr_strtoff(&num, arg, &end, 10)
- || num < 0 || num > APR_INT32_MAX || *end)
+ || *end || num < -1 || num > APR_INT32_MAX)
return apr_pstrcat(cmd->pool,
- "parameter must be a number between 0 and "
+ "parameter must be a number between -1 and "
APR_STRINGIFY(APR_INT32_MAX) ": ",
arg, NULL);
@@ -2395,7 +2395,6 @@ static const char *set_flush_max_pipelin
return NULL;
}
-
/*
* Report a missing-'>' syntax error.
*/
@@ -4733,9 +4732,10 @@ AP_INIT_TAKE1("EnableSendfile", set_enab
AP_INIT_TAKE1("ReadBufferSize", set_read_buf_size, NULL, ACCESS_CONF|RSRC_CONF,
"Size (in bytes) of the memory buffers used to read data"),
AP_INIT_TAKE1("FlushMaxThreshold", set_flush_max_threshold, NULL, RSRC_CONF,
- "Maximum size (in bytes) above which pending data are flushed (blocking) to the network"),
+ "Maximum threshold above which pending data are flushed to the network"),
AP_INIT_TAKE1("FlushMaxPipelined", set_flush_max_pipelined, NULL, RSRC_CONF,
- "Number of pipelined/pending responses above which they are flushed to the network"),
+ "Maximum number of pipelined responses (pending) above which they are "
+ "flushed to the network"),
/* Old server config file commands */
Modified: httpd/httpd/trunk/server/core_filters.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core_filters.c?rev=1884304&r1=1884303&r2=1884304&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core_filters.c (original)
+++ httpd/httpd/trunk/server/core_filters.c Fri Dec 11 11:33:00 2020
@@ -610,7 +610,7 @@ static apr_status_t send_brigade_nonbloc
* we are at the end of the brigade, the write will happen outside
* the loop anyway).
*/
- if (nbytes >= conf->flush_max_threshold
+ if (nbytes > conf->flush_max_threshold
&& next != APR_BRIGADE_SENTINEL(bb)
&& !is_in_memory_bucket(next)) {
(void)apr_socket_opt_set(s, APR_TCP_NOPUSH, 1);
Modified: httpd/httpd/trunk/server/util_filter.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_filter.c?rev=1884304&r1=1884303&r2=1884304&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util_filter.c (original)
+++ httpd/httpd/trunk/server/util_filter.c Fri Dec 11 11:33:00 2020
@@ -1104,7 +1104,7 @@ AP_DECLARE(apr_status_t) ap_filter_reins
* sent to the client.)
*
* c) The brigade contains at least flush_max_pipelined EOR buckets: do
- * blocking writes until the last EOR above flush_max_pipelined.
+ * blocking writes until after the last EOR above flush_max_pipelined.
* (The point of this rule is to prevent too many FDs being kept open
* by pipelined requests, possibly allowing a DoS).
*
@@ -1140,14 +1140,15 @@ AP_DECLARE(apr_status_t) ap_filter_reins
}
if (APR_BUCKET_IS_FLUSH(bucket)
- || memory_bytes_in_brigade >= conf->flush_max_threshold
- || eor_buckets_in_brigade >= conf->flush_max_pipelined) {
+ || (memory_bytes_in_brigade > conf->flush_max_threshold)
+ || (conf->flush_max_pipelined >= 0
+ && eor_buckets_in_brigade > conf->flush_max_pipelined)) {
/* this segment of the brigade MUST be sent before returning. */
if (APLOGctrace6(f->c)) {
char *reason = APR_BUCKET_IS_FLUSH(bucket) ?
"FLUSH bucket" :
- (memory_bytes_in_brigade >= conf->flush_max_threshold) ?
+ (memory_bytes_in_brigade > conf->flush_max_threshold) ?
"max threshold" : "max requests in pipeline";
ap_log_cerror(APLOG_MARK, APLOG_TRACE6, 0, f->c,
"will flush because of %s", reason);