Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

PAPERLESS_WEBSERVER_WORKERS option

jonaswinklerf07a6b458694
diff --git a/docs/changelog.rst b/docs/changelog.rst
index f51360258..1b3434117 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -5,6 +5,14 @@
Changelog
*********
+paperless-ng 1.1.3
+##################
+
+* Added a docker-specific configuration option to adjust the number of
+ worker processes of the web server. See :ref:`configuration-docker`.
+
+* Some more memory usage optimizations.
+
paperless-ng 1.1.2
##################
diff --git a/docs/configuration.rst b/docs/configuration.rst
index a307cc25a..95914e836 100644
--- a/docs/configuration.rst
+++ b/docs/configuration.rst
@@ -555,3 +555,65 @@ PAPERLESS_GS_BINARY=<path>
PAPERLESS_OPTIPNG_BINARY=<path>
Defaults to "/usr/bin/optipng".
+
+
+.. _configuration-docker:
+
+Docker-specific options
+#######################
+
+These options don't have any effect in ``paperless.conf``. These options adjust
+the behavior of the docker container. Configure these in `docker-compose.env`.
+
+PAPERLESS_WEBSERVER_WORKERS=<num>
+ The number of worker processes the webserver should spawn. More worker processes
+ usually result in the front end to load data much quicker. However, each worker process
+ also loads the entire application into memory separately, so increasing this value
+ will increase RAM usage.
+
+ Consider configuring this to 1 on low power devices with limited amount of RAM.
+
+ Defaults to 2.
+
+USERMAP_UID=<uid>
+ The ID of the paperless user in the container. Set this to your actual user ID on the
+ host system, which you can get by executing
+
+ .. code:: shell-session
+
+ $ id -u
+
+ Paperless will change ownership on its folders to this user, so you need to get this right
+ in order to be able to write to the consumption directory.
+
+ Defaults to 1000.
+
+USERMAP_GID=<gid>
+ The ID of the paperless Group in the container. Set this to your actual group ID on the
+ host system, which you can get by executing
+
+ .. code:: shell-session
+
+ $ id -g
+
+ Paperless will change ownership on its folders to this group, so you need to get this right
+ in order to be able to write to the consumption directory.
+
+ Defaults to 1000.
+
+PAPERLESS_OCR_LANGUAGES=<list>
+ Additional OCR languages to install. By default, paperless comes with
+ English, German, Italian, Spanish and French. If your language is not in this list, install
+ additional languages with this configuration option:
+
+ .. code:: bash
+
+ PAPERLESS_OCR_LANGUAGES=tur ces
+
+ To actually use these languages, also set the default OCR language of paperless:
+
+ .. code:: bash
+
+ PAPERLESS_OCR_LANGUAGE=tur
+
+ Defaults to none, which does not install any additional languages.
diff --git a/docs/setup.rst b/docs/setup.rst
index 4025b6721..8ebb6f83c 100644
--- a/docs/setup.rst
+++ b/docs/setup.rst
@@ -763,7 +763,8 @@ configuring some options in paperless can help improve performance immensely:
* Stick with SQLite to save some resources.
* Consider setting ``PAPERLESS_OCR_PAGES`` to 1, so that paperless will only OCR
- the first page of your documents.
+ the first page of your documents. In most cases, this page contains enough
+ information to be able to find it.
* ``PAPERLESS_TASK_WORKERS`` and ``PAPERLESS_THREADS_PER_WORKER`` are configured
to use all cores. The Raspberry Pi models 3 and up have 4 cores, meaning that
paperless will use 2 workers and 2 threads per worker. This may result in
@@ -776,6 +777,8 @@ configuring some options in paperless can help improve performance immensely:
file generation for already ocr'ed documents entirely.
* Set ``PAPERLESS_OPTIMIZE_THUMBNAILS`` to 'false' if you want faster consumption
times. Thumbnails will be about 20% larger.
+* If using docker, consider setting ``PAPERLESS_WEBSERVER_WORKERS`` to
+ 1. This will save some memory.
For details, refer to :ref:`configuration`.
diff --git a/gunicorn.conf.py b/gunicorn.conf.py
index 6fcbe6b0e..995b4fb9d 100644
--- a/gunicorn.conf.py
+++ b/gunicorn.conf.py
@@ -1,5 +1,7 @@
+import os
+
bind = '0.0.0.0:8000'
-workers = 2
+workers = int(os.getenv("PAPERLESS_WEBSERVER_WORKERS", 2))
worker_class = 'uvicorn.workers.UvicornWorker'
timeout = 120