blob: 1b6d89e4fed384de55518ce1c51383029246dddf [file] [log] [blame]
<?xml version="1.0"?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
<!-- $LastChangedRevision$ -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<modulesynopsis metafile="mod_buffer.xml.meta">
<name>mod_buffer</name>
<description>Support for request buffering</description>
<status>Extension</status>
<sourcefile>mod_buffer.c</sourcefile>
<identifier>buffer_module</identifier>
<compatibility>Available in Apache 2.3 and later</compatibility>
<summary>
<p>This module provides the ability to buffer the input and output
filter stacks.</p>
<p>Under certain circumstances, content generators might create
content in small chunks. In order to promote memory reuse, in
memory chunks are always 8k in size, regardless of the size of the
chunk itself. When many small chunks are generated by a request,
this can create a large memory footprint while the request is
being processed, and an unnecessarily large amount of data on the
wire. The addition of a buffer collapses the response into the
fewest chunks possible.</p>
<p>When httpd is used in front of an expensive content generator,
buffering the response may allow the backend to complete
processing and release resources sooner, depending on how the
backend is designed.</p>
<p>The buffer filter may be added to either the input or the
output filter stacks, as appropriate, using the
<directive module="core">SetInputFilter</directive>,
<directive module="core">SetOutputFilter</directive>,
<directive module="mod_mime">AddOutputFilter</directive> or
<directive module="mod_filter">AddOutputFilterByType</directive> directives.</p>
<example><title>Using buffer with mod_include</title>
<highlight language="config">
AddOutputFilterByType INCLUDES;BUFFER text/html
</highlight>
</example>
<note type="warning">The buffer filters read the request/response into
RAM and then repack the request/response into the fewest memory
buckets possible, at the cost of CPU time. When the request/response
is already efficiently packed, buffering the request/response could
cause the request/response to be slower than not using a buffer at
all. These filters should be used with care, and only where
necessary.</note>
</summary>
<seealso><a href="../filter.html">Filters</a></seealso>
<directivesynopsis>
<name>BufferSize</name>
<description>Maximum size in bytes to buffer by the buffer filter</description>
<syntax>BufferSize integer</syntax>
<default>BufferSize 131072</default>
<contextlist><context>server config</context>
<context>virtual host</context>
<context>directory</context>
<context>.htaccess</context>
</contextlist>
<usage>
<p>The <directive module="mod_buffer">BufferSize</directive>
directive specifies the amount of data in bytes that will be
buffered before being read from or written to each request.
The default is 128 kilobytes.</p>
</usage>
</directivesynopsis>
</modulesynopsis>