|
| 1 | +.. _config-neutron-server-processes: |
| 2 | + |
| 3 | +================================ |
| 4 | +Neutron server-side processes |
| 5 | +================================ |
| 6 | + |
| 7 | +On controller nodes, what is commonly referred to as ``neutron-server`` is |
| 8 | +actually a set of cooperating processes. Each process has a dedicated role: |
| 9 | +serving the REST API, handling RPC from agents, running periodic tasks, or |
| 10 | +performing ML2/OVN maintenance work. |
| 11 | + |
| 12 | +Since OpenStack Epoxy (2025.1), the Neutron API is served exclusively through |
| 13 | +a WSGI server (typically uWSGI). The companion processes listed below are |
| 14 | +started as separate services alongside the API. |
| 15 | + |
| 16 | + |
| 17 | +Overview |
| 18 | +-------- |
| 19 | + |
| 20 | +The following table summarizes the Neutron server-side processes: |
| 21 | + |
| 22 | +.. list-table:: |
| 23 | + :header-rows: 1 |
| 24 | + :widths: 15 30 20 25 |
| 25 | + |
| 26 | + * - Process |
| 27 | + - Executable / entry point |
| 28 | + - When it runs |
| 29 | + - Key configuration |
| 30 | + * - API |
| 31 | + - uWSGI workers loading ``neutron.wsgi.api:application`` |
| 32 | + - Always |
| 33 | + - uWSGI ``processes``, :ref:`config-wsgi` |
| 34 | + * - RPC |
| 35 | + - ``neutron-rpc-server`` (spawns ``rpc worker`` and |
| 36 | + ``rpc reports worker`` child processes) |
| 37 | + - When agents require RPC |
| 38 | + - ``api_workers``, ``rpc_workers``, ``rpc_state_report_workers`` |
| 39 | + * - Periodic |
| 40 | + - ``neutron-periodic-workers`` (runs plugin periodic tasks as threads) |
| 41 | + - With any ML2 mechanism driver and WSGI API |
| 42 | + - ``periodic_interval``, ``periodic_fuzzy_delay`` |
| 43 | + * - Maintenance |
| 44 | + - ``neutron-ovn-maintenance-worker`` |
| 45 | + - ML2/OVN deployments only |
| 46 | + - See :ref:`maintenance_worker` |
| 47 | + |
| 48 | +All of these processes load the same ``neutron.conf`` and plugin configuration |
| 49 | +files (for example ``ml2_conf.ini``). Only these server-side processes connect |
| 50 | +to the Neutron database; agents must not connect directly. |
| 51 | + |
| 52 | + |
| 53 | +API workers |
| 54 | +----------- |
| 55 | + |
| 56 | +The API workers serve the Neutron REST API. Each worker is a uWSGI process |
| 57 | +that loads the WSGI application entry point |
| 58 | +``neutron.wsgi.api:application``. |
| 59 | + |
| 60 | +The number of API workers is configured in the uWSGI configuration file |
| 61 | +(``processes`` option). Deployers should also review the worker tuning |
| 62 | +guidance in :doc:`config-wsgi`. |
| 63 | + |
| 64 | +.. note:: |
| 65 | + |
| 66 | + ML2/OVN requires the uWSGI ``start-time = %t`` parameter so that API |
| 67 | + workers can register themselves in the OVN hash ring during |
| 68 | + initialization. See :doc:`config-wsgi` for details. |
| 69 | + |
| 70 | + |
| 71 | +RPC workers |
| 72 | +------------- |
| 73 | + |
| 74 | +The ``neutron-rpc-server`` service handles RPC communication between the |
| 75 | +Neutron server and agents (for example DHCP, L3, and OVS agents). When |
| 76 | +started, it spawns two types of child worker processes: |
| 77 | + |
| 78 | +* **rpc worker** — handles general RPC requests from agents and other |
| 79 | + OpenStack services. The number of processes is controlled by |
| 80 | + ``[DEFAULT] rpc_workers``. |
| 81 | + |
| 82 | +* **rpc reports worker** — dedicated to processing agent state reports |
| 83 | + (heartbeats). The number of processes is controlled by |
| 84 | + ``[DEFAULT] rpc_state_report_workers``. |
| 85 | + |
| 86 | +When the Neutron API is served by an external web server (such as Apache with |
| 87 | +``mod_wsgi``), RPC listeners cannot run inside the API process. In that case, |
| 88 | +``neutron-rpc-server`` must be started as a separate service. See |
| 89 | +:doc:`config-wsgi` for an example command. |
| 90 | + |
| 91 | +.. note:: |
| 92 | + |
| 93 | + If the ML2/OVN mechanism driver is used without additional agents that |
| 94 | + require RPC, both ``rpc_workers`` and ``rpc_state_report_workers`` can be |
| 95 | + set to ``0``. See :doc:`ovn/rpc` for more information. |
| 96 | + |
| 97 | + |
| 98 | +Periodic workers |
| 99 | +---------------- |
| 100 | + |
| 101 | +The ``neutron-periodic-workers`` service runs periodic tasks registered by |
| 102 | +the ML2 plugin and service plugins (for example DHCP agent scheduling, |
| 103 | +quota synchronization, and agent health checks). These tasks are collected |
| 104 | +via each plugin's ``get_workers()`` method and executed as threads inside |
| 105 | +a single process (internally referred to as the **services worker**). |
| 106 | + |
| 107 | +This process is spawned for any deployment using the Neutron API WSGI module |
| 108 | +with an ML2 mechanism driver. |
| 109 | + |
| 110 | + |
| 111 | +Maintenance worker |
| 112 | +------------------ |
| 113 | + |
| 114 | +The ``neutron-ovn-maintenance-worker`` service is required only when using |
| 115 | +the ML2/OVN mechanism driver. It synchronizes the Neutron and OVN databases |
| 116 | +and runs periodic inconsistency checks. |
| 117 | + |
| 118 | +For details on what the maintenance worker does and how plugins can register |
| 119 | +additional periodic tasks, see :ref:`maintenance_worker`. |
| 120 | + |
| 121 | + |
| 122 | +Process identification |
| 123 | +---------------------- |
| 124 | + |
| 125 | +Neutron child processes set descriptive process titles (for example |
| 126 | +``api worker``, ``rpc worker``, ``rpc reports worker``, ``periodic worker``, |
| 127 | +``services worker``, and ``maintenance worker``) to make them easy to identify |
| 128 | +with tools such as ``ps``. |
| 129 | + |
| 130 | +This behavior is controlled by the ``[DEFAULT] setproctitle`` option in |
| 131 | +``neutron.conf``. When set to ``brief``, process titles are shorter and easier |
| 132 | +to read. The default is ``on``, which appends the original command string for |
| 133 | +backwards compatibility with scripts that match on the old process names. |
| 134 | + |
| 135 | + |
| 136 | +Configuration reference |
| 137 | +----------------------- |
| 138 | + |
| 139 | +The following ``neutron.conf`` options control worker counts and periodic |
| 140 | +task behavior: |
| 141 | + |
| 142 | +``api_workers`` |
| 143 | + Number of API worker processes. If not set, defaults to the number of CPU |
| 144 | + cores, capped by available memory. |
| 145 | + |
| 146 | +``rpc_workers`` |
| 147 | + Number of RPC worker processes. If not set, defaults to half the number of |
| 148 | + API workers. Set to ``0`` to disable RPC workers entirely. |
| 149 | + |
| 150 | +``rpc_state_report_workers`` |
| 151 | + Number of RPC worker processes dedicated to agent state reports. Defaults |
| 152 | + to ``1``. Set to ``0`` to disable the dedicated state-report workers. |
| 153 | + |
| 154 | +``periodic_interval`` |
| 155 | + Seconds between running periodic tasks. Defaults to ``40``. |
| 156 | + |
| 157 | +``periodic_fuzzy_delay`` |
| 158 | + Random delay range (in seconds) when starting the periodic task scheduler, |
| 159 | + to reduce stampeding across workers. Defaults to ``5``. Set to ``0`` to |
| 160 | + disable. |
| 161 | + |
| 162 | +For the full list of options and their defaults, see |
| 163 | +:doc:`../configuration/neutron`. |
0 commit comments