Skip to content

Commit 0dfc0a3

Browse files
committed
Add notes on redis connection pool to greenlet doc
Fixes #809
1 parent 8208d64 commit 0dfc0a3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

docs/consumer.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ their default values.
7272
If you have a CPU-intensive workload, you may want to increase the number
7373
of workers to the number of CPU cores (or 2x CPU cores). Lastly, if you are
7474
using the ``greenlet`` worker type, you can easily run tens or hundreds of
75-
workers as they are extremely lightweight.
75+
workers as they are extremely lightweight (however make sure, when using
76+
Redis, that you create a large enough pool for all these connections).
7677

7778
``-k``, ``--worker-type``
7879
Choose the worker type, ``thread``, ``process`` or ``greenlet``. The
@@ -91,7 +92,8 @@ their default values.
9192
cheap in terms of memory, you can easily run a large number of workers.
9293
Note that all code that does **not** consist in waiting for a socket will
9394
be blocking and cannot be pre-empted. Understand the tradeoffs before
94-
jumping to use greenlets.
95+
jumping to use greenlets. When using with Redis, ensure that your
96+
connection pool is large enough to provide connections for each greenlet.
9597
* Anything else: use "thread". You get the benefits of pre-emptive
9698
multi-tasking without the overhead of multiple processes. A safe choice
9799
and the default.
@@ -214,7 +216,9 @@ different mechanisms to achieve this concurrency.
214216
reason, gevent is a good choice for tasks that perform lots of socket I/O,
215217
but may give worse performance for tasks that are CPU-bound (e.g., parsing
216218
large files, manipulating images, generating reports, etc). Understand the
217-
tradeoff thoroughly before using this worker type.
219+
tradeoff thoroughly before using this worker type. When using Redis, ensure
220+
that your connection pool is large enough for each greenlet to have its own
221+
connection.
218222

219223
When in doubt, the default setting (``thread``) is a safe choice.
220224

0 commit comments

Comments
 (0)