root: make Celery worker concurrency configurable (#6837)
* root: made Celery worker concurrency configurable * core: fixed Celery worker command to set autoscaling options to account for worker concurrency setting * Update website/docs/installation/configuration.md Signed-off-by: Jens L. <jens@beryju.org> Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens L. <jens@beryju.org> Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: Jens L <jens@beryju.org>
This commit is contained in:
parent
e807f9f12c
commit
0e5952650b
|
@ -29,7 +29,7 @@ class Command(BaseCommand):
|
||||||
no_color=False,
|
no_color=False,
|
||||||
quiet=True,
|
quiet=True,
|
||||||
optimization="fair",
|
optimization="fair",
|
||||||
autoscale=(3, 1),
|
autoscale=(CONFIG.get_int("worker.concurrency"), 1),
|
||||||
task_events=True,
|
task_events=True,
|
||||||
beat=options.get("beat", True),
|
beat=options.get("beat", True),
|
||||||
schedule_filename=f"{tempdir}/celerybeat-schedule",
|
schedule_filename=f"{tempdir}/celerybeat-schedule",
|
||||||
|
|
|
@ -111,3 +111,6 @@ web:
|
||||||
# No default here as it's set dynamically
|
# No default here as it's set dynamically
|
||||||
# workers: 2
|
# workers: 2
|
||||||
threads: 4
|
threads: 4
|
||||||
|
|
||||||
|
worker:
|
||||||
|
concurrency: 2
|
||||||
|
|
|
@ -332,7 +332,7 @@ LOCALE_PATHS = ["./locale"]
|
||||||
CELERY = {
|
CELERY = {
|
||||||
"task_soft_time_limit": 600,
|
"task_soft_time_limit": 600,
|
||||||
"worker_max_tasks_per_child": 50,
|
"worker_max_tasks_per_child": 50,
|
||||||
"worker_concurrency": 2,
|
"worker_concurrency": CONFIG.get_int("worker.concurrency"),
|
||||||
"beat_schedule": {
|
"beat_schedule": {
|
||||||
"clean_expired_models": {
|
"clean_expired_models": {
|
||||||
"task": "authentik.core.tasks.clean_expired_models",
|
"task": "authentik.core.tasks.clean_expired_models",
|
||||||
|
|
|
@ -363,6 +363,16 @@ Configure how many gunicorn threads a worker processes should have (see https://
|
||||||
|
|
||||||
Defaults to 4.
|
Defaults to 4.
|
||||||
|
|
||||||
|
### `AUTHENTIK_WORKER__CONCURRENCY`
|
||||||
|
|
||||||
|
:::info
|
||||||
|
Requires authentik 2023.9.0
|
||||||
|
:::
|
||||||
|
|
||||||
|
Configure Celery worker concurrency for authentik worker (see https://docs.celeryq.dev/en/latest/userguide/configuration.html#worker-concurrency). This essentially defines the number of worker processes spawned for a single worker.
|
||||||
|
|
||||||
|
Defaults to 2.
|
||||||
|
|
||||||
## Custom python settings
|
## Custom python settings
|
||||||
|
|
||||||
To modify additional settings further than the options above allow, you can create a custom python file and mount it to `/data/user_settings.py`. This file will be loaded on startup by both the server and the worker. All default settings are [here](https://github.com/goauthentik/authentik/blob/main/authentik/root/settings.py)
|
To modify additional settings further than the options above allow, you can create a custom python file and mount it to `/data/user_settings.py`. This file will be loaded on startup by both the server and the worker. All default settings are [here](https://github.com/goauthentik/authentik/blob/main/authentik/root/settings.py)
|
||||||
|
|
Reference in New Issue