Browse Source

[OVN] Change the default metadata_workers to 2

Prior to this patch, the metadata_workers parameter defaults to
$os_workers (calculated here [0]) but, even tho it's capped at 12 workers
this number still redundant.

There are a few differences of how the OVN metadata agent works compared
with the OVS metadata agents:

1) The OVN metadata workers are deployed onto the compute nodes and not
   on the controllers/gateways as the OVS ones are. This means it's
   better distributed.

2) Even tho we could have multiple workers, the OVN SB IDL in the OVN
   metadata agents acquires a lock while listening to OVSDB events.
   Therefore, even tho we could have dozens of agents only one of them
   is listening to the events.

3) Instantiating IDLs means maintaining in-memory replicas of the
   OVSDB (or, the tables of that DB that is being watched). This puts a
   burden on OVSDBs to maintain all these replicas updated, reducing
   this number workers also reduces the burden on the OVSDBs.

This patch is reducing the default number of OVN metadata agents to two
(per compute). Two because that keeps it HA, in case the active agente
dies the lock moves to the other one and the service will keep working.

74e0f5a317/lib/facter/os_workers.rb (L37)

Change-Id: I6b9cc2aff14ce38a56c2757d9ad6c56898e27247
Signed-off-by: Lucas Alvares Gomes <>
(cherry picked from commit 847f434140)
(cherry picked from commit 2ed6a1936a)
Lucas Alvares Gomes 7 months ago
3 changed files with 14 additions and 3 deletions
  1. +2
  2. +11
  3. +1

+ 2
- 2
manifests/agents/ovn_metadata.pp View File

@@ -45,7 +45,7 @@
# (optional) Number of separate worker processes to spawn. Greater than 0
# launches that number of child processes as workers. The parent process
# manages them.
# Defaults to: $::os_workers
# Defaults to: 2
# [*metadata_backlog*]
# (optional) Number of backlog requests to configure the metadata server socket with.
@@ -103,7 +103,7 @@ class neutron::agents::ovn_metadata (
$metadata_host = $::os_service_default,
$metadata_port = $::os_service_default,
$metadata_protocol = $::os_service_default,
$metadata_workers = $::os_workers,
$metadata_workers = 2,
$metadata_backlog = $::os_service_default,
$metadata_insecure = $::os_service_default,
$nova_client_cert = $::os_service_default,

+ 11
- 0
releasenotes/notes/reduce-ovn-metadata-workers-6ed825307997f8b9.yaml View File

@@ -0,0 +1,11 @@
- |
Switched the default value of the ``metadata_workers`` configuration
option for the OVN metadata agents to 2 (from $::os_workers). While
the OVS metadata agents runs on the controllers/gateway nodes (and
defaults to $::os_workers) the OVN metadata agents are distributed
and runs on the compute nodes instead so, there's no point in running
dozen of them on each compute. Also, by reducing the number of workers
we also reduce the burden on the OVSDB that the OVN metadata agent
connects to making OVN more scalable.

+ 1
- 1
spec/classes/neutron_agents_ovn_metadata_spec.rb View File

@@ -63,7 +63,7 @@ describe 'neutron::agents::ovn_metadata' do contain_ovn_metadata_agent_config('DEFAULT/nova_metadata_host').with(:value => '<SERVICE DEFAULT>') contain_ovn_metadata_agent_config('DEFAULT/nova_metadata_port').with(:value => '<SERVICE DEFAULT>') contain_ovn_metadata_agent_config('DEFAULT/nova_metadata_protocol').with(:value => '<SERVICE DEFAULT>') contain_ovn_metadata_agent_config('DEFAULT/metadata_workers').with(:value => facts[:os_workers]) contain_ovn_metadata_agent_config('DEFAULT/metadata_workers').with(:value => 2) contain_ovn_metadata_agent_config('DEFAULT/metadata_backlog').with(:value => '<SERVICE DEFAULT>') contain_ovn_metadata_agent_config('DEFAULT/nova_metadata_insecure').with(:value => '<SERVICE DEFAULT>') contain_ovn_metadata_agent_config('DEFAULT/state_path').with(:value => params[:state_path])