Debian Codegraph @

docs/userguide/concurrency/index.rst

raw
1 .. _concurrency:
2
3 =============
4 Concurrency
5 =============
6
7 :Release: |version|
8 :Date: |today|
9
10 Concurrency in Celery enables the parallel execution of tasks. The default
11 model, `prefork`, is well-suited for many scenarios and generally recommended
12 for most users. In fact, switching to another mode will silently disable
13 certain features like `soft_timeout` and `max_tasks_per_child`.
14
15 This page gives a quick overview of the available options which you can pick
16 between using the `--pool` option when starting the worker.
17
18 Overview of Concurrency Options
19 -------------------------------
20
21 - `prefork`: The default option, ideal for CPU-bound tasks and most use cases.
22 It is robust and recommended unless there's a specific need for another model.
23 - `eventlet` and `gevent`: Designed for IO-bound tasks, these models use
24 greenlets for high concurrency. Note that certain features, like `soft_timeout`,
25 are not available in these modes. These have detailed documentation pages
26 linked below.
27 - `solo`: Executes tasks sequentially in the main thread.
28 - `threads`: Utilizes threading for concurrency, available if the
29 `concurrent.futures` module is present.
30 - `custom`: Enables specifying a custom worker pool implementation through
31 environment variables.
32
33 .. toctree::
34 :maxdepth: 2
35
36 eventlet
37 gevent
38
39 .. note::
40 While alternative models like `eventlet` and `gevent` are available, they
41 may lack certain features compared to `prefork`. We recommend `prefork` as
42 the starting point unless specific requirements dictate otherwise.