.. /* * This file is part of the SavaPage project . * Copyright (c) 2026 Datraverse B.V. * Author: Rijk Ravestein. * * SPDX-FileCopyrightText: (c) 2020 Datraverse B.V. * SPDX-License-Identifier: CC-BY-SA-4.0 * * For more information, please contact Datraverse B.V. at this * address: info@datraverse.com */ .. _ch-tuning-ulimit: Linux User Limits ----------------- .. contents:: |RST_TABLE_OF_CONTENTS| :depth: 2 :local: .. _ch-tuning-ulimit-intro: Introduction ~~~~~~~~~~~~ SavaPage server may run out of file descriptors as the system defaults are normally very low. A file descriptor (FD) is a handle created by a process when a file is opened. Each process can use a limited number of FDs as specified per user in an OS level user limit. Beware that apart from “regular” files that are accessed by |PRODUCT_NAME| from disk, each incoming request that uses a TCP socket also consumes one file descriptor from the total available for the process. .. _ch-tuning-ulimit-sysvinit: SysVinit User Limits ~~~~~~~~~~~~~~~~~~~~ On Debian based systems the number of process FDs for the ``savapage`` user can be increased as follows. Edit the file Edit ``/etc/security/limits.conf`` like this: .. code-block:: bash sudo vi /etc/security/limits.conf ... and add the following lines at the end of the file: .. code-block:: text savapage hard nofile 65536 savapage soft nofile 65536 Next, open ``/etc/pam.d/su`` like this: .. code-block:: bash sudo vi /etc/pam.d/su ... and uncomment the following line: .. code-block:: text session required pam_limits.so You also need to edit the ``/etc/pam.d/common-session`` and ``/etc/pam.d/common-session-noninteractive`` files. Open the files like this: .. code-block:: bash sudo vi /etc/pam.d/common-session sudo vi /etc/pam.d/common-session-noninteractive and for each file add the following line to the end: .. code-block:: text session required pam_limits.so Finally, check whether the settings are applied with this command: .. code-block:: bash sudo su - savapage -c "ulimit -n" This should output the value ``65536``. .. _ch-tuning-ulimit-systemd: Systemd User Limits ~~~~~~~~~~~~~~~~~~~ Systemd ignores ``ulimit`` values as described in the previous section, and has its own equivalent that can be used per service. The best way to set user limits for the ``savapage.service`` is by an *override*, that will have the last say over any SavaPage default. Check the ``/lib/systemd/system/savapage.service`` unit to see if the value of the ``LimitNOFILE`` directive is to your liking. This directive corresponds to ``ulimit -n`` (open files) and defaults to ``65536``. .. code-block:: bash cat /lib/systemd/system/savapage.service | grep LimitNOFILE`` If this directive is absent, or if you want to override the value, edit the service unit with this command: .. code-block:: bash sudo systemctl edit savapage This launches a text editor for creating this file: ``/etc/systemd/system/savapage.service.d/override.conf`` Add the following lines, using your own choice (e.g. 98304): .. code-block:: ini [Service] LimitNOFILE=98304 Save the file and close the editor. Usually, after you edited a systemd unit file, for it to take effect, you need to run: .. code-block:: bash sudo systemctl daemon-reload However, the ``systemctl edit`` command automatically did this for you. You can check the effect of the override with this command: .. code-block:: bash systemctl cat savapage.service | grep LimitNOFILE ... the last line should show: .. code-block:: bash LimitNOFILE=98304 Restart SavaPage for the changes to take effect, and check if the override has effect with this command: .. code-block:: bash systemctl status savapage.service Notice the Drop-In ``override.conf`` as shown below: .. code-block:: bash savapage.service - SavaPage Open Print Portal Loaded: loaded (/lib/systemd/system/savapage.service; enabled; vendor preset: enabled) Drop-In: /etc/systemd/system/savapage.service.d |- override.conf Active: active (running) since ... .. important:: Check if the “open files” override value is shown correctly in the :ref:`Host System ` section of the Admin Web App, since this is the actual value that the |PRODUCT_NAME| server process uses.