optimization.rst 1.38 KB
Newer Older
1
2
3
4
Optimizing your Funkwhale instance
==================================

Depending on your requirements, you may want to reduce as much as possible
5
Funkwhale's memory footprint.
6
7
8
9
10
11
12
13

Reduce workers concurrency
--------------------------

Asynchronous tasks are handled by a celery worker, which will by default
spawn a worker process per CPU available. This can lead to a higher
memory usage.

14
You can control this behavior using the ``--concurrency`` flag.
15
16
For instance, setting ``--concurrency=1`` will spawn only one worker.

17
18
19
This flag should be appended after the ``celery -A funkwhale_api.taskapp
worker`` command in your :file:`docker-compose.yml` file if your using Docker,
or in your :file:`/etc/systemd/system/funkwhale-worker.service` otherwise.
20
21
22
23
24
25
26
27
28
29
30
31
32

.. note::

    Reducing concurrency comes at a cost: asynchronous tasks will be processed
    more slowly. However, on small instances, this should not be an issue.


Switch from prefork to solo pool
--------------------------------

Using a different pool implementation for Celery tasks may also help.

Using the ``solo`` pool type should reduce your memory consumption.
33
You can control this behavior using the ``--pool=solo`` flag.
34
35

This flag should be appended after the ``celery -A funkwhale_api.taskapp worker``
36
37
command in your :file:`docker-compose.yml` file if you're using Docker, or in
your :file:`/etc/systemd/system/funkwhale-worker.service` otherwise.