From 0e4e0779e63c080777bfddb02de4cb828cfdb1c7 Mon Sep 17 00:00:00 2001 From: Tuukka Mustonen Date: Thu, 15 Jun 2017 20:10:06 +0300 Subject: [PATCH] doc: Notes about worker keepalive support --- docs/source/design.rst | 4 ++++ docs/source/settings.rst | 9 ++++++++- gunicorn/config.py | 9 ++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/docs/source/design.rst b/docs/source/design.rst index c521512f..d79062f6 100644 --- a/docs/source/design.rst +++ b/docs/source/design.rst @@ -34,6 +34,10 @@ as any errors will affect at most a single request. Though as we describe below only processing a single request at a time requires some assumptions about how applications are programmed. +``sync`` worker does not support persistent connections - each connection is +closed after response has been sent (even if you manually add ``Keep-Alive`` +or ``Connection: keep-alive`` header in your application). + Async Workers ------------- diff --git a/docs/source/settings.rst b/docs/source/settings.rst index 49bf58d4..72db2716 100644 --- a/docs/source/settings.rst +++ b/docs/source/settings.rst @@ -234,7 +234,14 @@ keepalive The number of seconds to wait for requests on a Keep-Alive connection. -Generally set in the 1-5 seconds range. +Generally set in the 1-5 seconds range for servers with direct connection +to the client (e.g. when you don't have separate load balancer). When +Gunicorn is deployed behind a load balancer, it often makes sense to +set this to a higher value. + +.. note:: + ``sync`` worker does not support persistent connections and will + ignore this option. Security -------- diff --git a/gunicorn/config.py b/gunicorn/config.py index c0aec1a4..0c2276b0 100644 --- a/gunicorn/config.py +++ b/gunicorn/config.py @@ -760,7 +760,14 @@ class Keepalive(Setting): desc = """\ The number of seconds to wait for requests on a Keep-Alive connection. - Generally set in the 1-5 seconds range. + Generally set in the 1-5 seconds range for servers with direct connection + to the client (e.g. when you don't have separate load balancer). When + Gunicorn is deployed behind a load balancer, it often makes sense to + set this to a higher value. + + .. note:: + ``sync`` worker does not support persistent connections and will + ignore this option. """