Browse Source

Merge "Increase default metadata_workers, backlog to 4096"

changes/75/99275/6
Jenkins 8 years ago committed by Gerrit Code Review
parent
commit
043f04c159
  1. 7
      etc/metadata_agent.ini
  2. 4
      neutron/agent/metadata/agent.py
  3. 8
      neutron/common/utils.py

7
etc/metadata_agent.ini

@ -45,11 +45,12 @@ admin_password = %SERVICE_PASSWORD%
# Location of Metadata Proxy UNIX domain socket
# metadata_proxy_socket = $state_path/metadata_proxy
# Number of separate worker processes for metadata server
# metadata_workers = 0
# Number of separate worker processes for metadata server. Defaults to
# half the number of CPU cores
# metadata_workers =
# Number of backlog requests to configure the metadata server socket with
# metadata_backlog = 128
# metadata_backlog = 4096
# URL to connect to the cache backend.
# default_ttl=0 parameter will cause cache entries to never expire.

4
neutron/agent/metadata/agent.py

@ -307,11 +307,11 @@ class UnixDomainMetadataProxy(object):
default='$state_path/metadata_proxy',
help=_('Location for Metadata Proxy UNIX domain socket')),
cfg.IntOpt('metadata_workers',
default=0,
default=utils.cpu_count() // 2,
help=_('Number of separate worker processes for metadata '
'server')),
cfg.IntOpt('metadata_backlog',
default=128,
default=4096,
help=_('Number of backlog requests to configure the '
'metadata server socket with'))
]

8
neutron/common/utils.py

@ -22,6 +22,7 @@ import datetime
import functools
import hashlib
import logging as std_logging
import multiprocessing
import os
import random
import signal
@ -291,3 +292,10 @@ def get_dhcp_agent_device_id(network_id, host):
local_hostname = host.split('.')[0]
host_uuid = uuid.uuid5(uuid.NAMESPACE_DNS, str(local_hostname))
return 'dhcp%s-%s' % (host_uuid, network_id)
def cpu_count():
try:
return multiprocessing.cpu_count()
except NotImplementedError:
return 1

Loading…
Cancel
Save