File: index.rst

package info (click to toggle)
celery 5.5.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,008 kB
  • sloc: python: 64,346; sh: 795; makefile: 378
file content (42 lines) | stat: -rw-r--r-- 1,561 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
.. _concurrency:

=============
 Concurrency
=============

:Release: |version|
:Date: |today|

Concurrency in Celery enables the parallel execution of tasks. The default
model, `prefork`, is well-suited for many scenarios and generally recommended
for most users.  In fact, switching to another mode will silently disable
certain features like `soft_timeout` and `max_tasks_per_child`.

This page gives a quick overview of the available options which you can pick
between using the `--pool` option when starting the worker.

Overview of Concurrency Options
-------------------------------

- `prefork`: The default option, ideal for CPU-bound tasks and most use cases.
  It is robust and recommended unless there's a specific need for another model.
- `eventlet` and `gevent`: Designed for IO-bound tasks, these models use
  greenlets for high concurrency. Note that certain features, like `soft_timeout`,
  are not available in these modes.  These have detailed documentation pages
  linked below.
- `solo`: Executes tasks sequentially in the main thread.
- `threads`: Utilizes threading for concurrency, available if the
  `concurrent.futures` module is present.
- `custom`: Enables specifying a custom worker pool implementation through
  environment variables.

.. toctree::
    :maxdepth: 2

    eventlet
    gevent

.. note::
    While alternative models like `eventlet` and `gevent` are available, they
    may lack certain features compared to `prefork`. We recommend `prefork` as
    the starting point unless specific requirements dictate otherwise.