From 235774f7a389afe41d559cd3e1f762ba5a5abe3e Mon Sep 17 00:00:00 2001 From: Stefan Eissing Date: Wed, 10 Feb 2016 16:57:29 +0000 Subject: [PATCH] added dimensioning and mutlti domain sections git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1729655 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/mod/mod_http2.xml | 168 ++++++++++++++++++++++++++-------- 1 file changed, 131 insertions(+), 37 deletions(-) diff --git a/docs/manual/mod/mod_http2.xml b/docs/manual/mod/mod_http2.xml index ad1a887733..6eeb1b013a 100644 --- a/docs/manual/mod/mod_http2.xml +++ b/docs/manual/mod/mod_http2.xml @@ -37,25 +37,25 @@ to provide the core http/2 engine.

Warning -

This module is experimental. Its behaviors, directives, and - defaults are subject to more change from release to - release relative to other standard modules. Users are encouraged to - consult the "CHANGES" file for potential updates.

+

This module is experimental. Its behaviors, directives, and + defaults are subject to more change from release to + release relative to other standard modules. Users are encouraged to + consult the "CHANGES" file for potential updates.

- +

You must enable HTTP/2 via Protocols in order to use the + module="core">Protocols in order to use the functionality described in this document:

- + Protocols h2 http/1.1 - +
Environment Variables - -

This module can be configured to provide HTTP/2 related information +

+ This module can be configured to provide HTTP/2 related information as additional environment variables to the SSI and CGI namespace.

@@ -67,12 +67,106 @@ Value Type: Description: - HTTPe flag HTTP/2 is being used. - H2PUSH flag HTTP/2 Server Push is enabled for this request and also supported by the client. + HTTP2flagHTTP/2 is being used. + H2PUSHflagHTTP/2 Server Push is enabled for this request and also supported by the client. -
- + +
HTTP/2 Dimensioning +

+ Enabling HTTP/2 on your Apache Server has impact on the resource + consumption and if you have a busy site, you may need to consider + carefully the implications. +

+

+ The first noticable thing after enabling HTTP/2 is that your server + processes will start additional threads. The reason for this is that + HTTP/2 gives all requests that it receives to its own Worker + threads for processing, collects the results and streams them out + to the client. +

+

+ In the current implementation, these workers use a separate thread + pool from the MPM workers that you might be familiar with. This is + just how things are right now and not intended to be like this forever. + (It might be forever for the 2.4.x release line, though.) So, HTTP/2 + workers, or shorter H2Workers, will not show up in mod_status. They + are also not counted against directives such as ThreadsPerChild. However + they take ThreadsPerChild as default if you have not configured something + else via H2MinWorkers and + H2MaxWorkers. +

+

+ Another thing to watch out for is is memory consumption. Since HTTP/2 + keeps more state on the server to manage all the open request, priorities + for and dependencies between them, it will always need more memory + than HTTP/1.1 processing. There are three directives which steer the + memory footprint of a HTTP/2 connection: + H2MaxSessionStreams, + H2WindowSize and + H2StreamMaxMemSize. +

+

+ H2MaxSessionStreams limits the + number of parallel requests that a client can make on a HTTP/2 connection. + It depends on your site how many you should allow. The default is 100 which + is plenty and unless you run into memory problems, I would keep it this + way. Most requests that browsers send are GETs without a body, so they + use up only a little bit of memory until the actual processing starts. +

+

+ H2WindowSize controls how much + the client is allowed to send as body of a request, before it waits + for the server to encourage more. Or, the other way around, it is the + amount of request body data the server needs to be able to buffer. This + is per request. +

+

+ And last, but not least, H2StreamMaxMemSize + controls how much response data shall be buffered. The request sits in + a H2Worker thread and is producing data, the HTTP/2 connection tries + to send this to the client. If the client does not read fast enough, + the connection will buffer this amount of data and then suspend the + H2Worker. +

+

+ If you serve a lot of static files, H2SessionExtraFiles + is of interest. This tells the server how many file handles per + HTTP/2 connection it is allowed to waste for better performance. Because + when a request produces a static file as the response, the file handle + gets passed around and is buffered and not the file contents. That allows + to serve many large files without wasting memory or copying data + unnecessarily. However file handles are a limited resource for a process, + and if too many are used this way, requests may fail under load as + the amount of open handles has been exceeded. +

+
+ +
Multiple Hosts and Misdirected Requests +

+ Many sites use the same TLS certificate for multiple virtual hosts. The + certificate either has a wildcard name, such as '*.example.org' or carries + several alternate names. Browsers using HTTP/2 will recognize that and reuse + an already opened connection for such hosts. +

+

+ While this is great for performance, it comes at a price: such vhosts + need more care in their configuration. The problem is that you will have + multiple requests for multiple hosts on the same TLS connection. And that + makes renegotiation impossible, in face the HTTP/2 standard forbids it. +

+

+ So, if you have several virtual hosts using the same certificate and + want to use HTTP/2 for them, you need to make sure that all vhosts have + exactly the same SSL configuration. You need the same protocol, + ciphers and settings for client verification. +

+

+ If you mix things, Apache httpd will detect it and return a special + response code, 421 Misidrected Request, to the client. +

+
+ H2Direct H2 Direct Protocol Switch @@ -122,7 +216,7 @@ - + H2Push H2 Server Push Switch @@ -162,10 +256,10 @@

mod_headers example -<Location /index.html> - Header add Link "</css/site.css>;rel=preload" - Header add Link "</images/logo.jpg>;rel=preload" -</Location> + <Location /index.html> + Header add Link "</css/site.css>;rel=preload" + Header add Link "</images/logo.jpg>;rel=preload" + </Location>

@@ -192,7 +286,7 @@

- + H2PushDiarySize H2 Server Push Diary Size @@ -229,7 +323,7 @@

- + H2PushPriority H2 Server Push Priority @@ -240,7 +334,7 @@ virtual host Available in version 2.4.18 and later. For having an - effect, a nghttp2 library version 1.5.0 or newer is necessary. + effect, a nghttp2 library version 1.5.0 or newer is necessary.

@@ -346,21 +440,21 @@

  1. '*' is the only special content-type that matches all others. - 'image/*' will not work.
  2. + 'image/*' will not work.
  3. The default dependency is 'After'.
  4. There are also default weights: for 'After' it is 16, 'interleaved' is 256.
Shorter Priority Rules -H2PushPriority application/json 32 # an After rule -H2PushPriority image/jpeg before # weight inherited -H2PushPriority text/css interleaved # weight 256 default + H2PushPriority application/json 32 # an After rule + H2PushPriority image/jpeg before # weight inherited + H2PushPriority text/css interleaved # weight 256 default
- + H2Upgrade H2 Upgrade Protocol Switch @@ -456,7 +550,7 @@ H2PushPriority text/css interleaved # weight 256 default - + H2WindowSize Size of Stream Window for upstream data. @@ -484,7 +578,7 @@ H2PushPriority text/css interleaved # weight 256 default - + H2MinWorkers Minimal number of worker threads to use per child process. @@ -506,7 +600,7 @@ H2PushPriority text/css interleaved # weight 256 default - + H2MaxWorkers Maximum number of worker threads to use per child process. @@ -528,7 +622,7 @@ H2PushPriority text/css interleaved # weight 256 default - + H2MaxWorkerIdleSeconds Maximum number of seconds h2 workers remain idle until shut down. @@ -550,7 +644,7 @@ H2PushPriority text/css interleaved # weight 256 default - + H2SessionExtraFiles Number of Extra File Handles @@ -591,7 +685,7 @@ H2PushPriority text/css interleaved # weight 256 default

- + H2SerializeHeaders Serialize Request/Response Processing Switch @@ -619,7 +713,7 @@ H2PushPriority text/css interleaved # weight 256 default - + H2ModernTLSOnly Require HTTP/2 connections to be "modern TLS" only @@ -630,7 +724,7 @@ H2PushPriority text/css interleaved # weight 256 default virtual host Available in version 2.4.18 and later. - +

This directive toggles the security checks on HTTP/2 connections @@ -667,7 +761,7 @@ H2PushPriority text/css interleaved # weight 256 default - + H2TLSWarmUpSize @@ -689,7 +783,7 @@ H2PushPriority text/css interleaved # weight 256 default

Measurements by google performance - labs show that best performance on TLS connections is reached, + labs show that best performance on TLS connections is reached, if initial record sizes stay below the MTU level, to allow a complete record to fit into an IP packet.

-- 2.40.0