Limit open file descriptors for Neutron agent containers

See https://bugs.launchpad.net/oslo.rootwrap/+bug/1760471, in particular
comment #1 for an explanation of why inheriting the defaults of the
docker daemon can cause poor performance:

The performance difference likely comes from close_fds=True of subprocess.
Popen. On Python 2, Popen calls close(fd) on all file descriptors from 3 to
SC_OPEN_MAX. On my Fedora 27 "host", SC_OPEN_MAX is 1,024. But in docker,
SC_OPEN_MAX is... 1,048,576: 1,000x larger. On Python 3, Popen is smarter. On
Linux, it lists the content of /proc/self/fd/ to only close open file
descriptors. It doesn't depend on SC_OPEN_MAX value.

Change-Id: Iefef6039644192420abbd3bf614329cbc0d9a62a
Closes-Bug: #1848737
Related-Bug: #1760471
Related-Bug: #1757556
Related-Bug: #1824020
This commit is contained in:
Will Szumski 2019-10-18 17:48:49 +01:00
parent b73b9eab26
commit ae5acc7f3c

@ -218,17 +218,29 @@ ironic_neutron_agent_image: "{{ docker_registry ~ '/' if docker_registry else ''
ironic_neutron_agent_tag: "{{ neutron_tag }}"
ironic_neutron_agent_image_full: "{{ ironic_neutron_agent_image }}:{{ ironic_neutron_agent_tag }}"
neutron_dhcp_agent_dimensions: "{{ default_container_dimensions }}"
neutron_l3_agent_dimensions: "{{ default_container_dimensions }}"
neutron_sriov_agent_dimensions: "{{ default_container_dimensions }}"
neutron_linuxbridge_agent_dimensions: "{{ default_container_dimensions }}"
neutron_metadata_agent_dimensions: "{{ default_container_dimensions }}"
neutron_openvswitch_agent_dimensions: "{{ default_container_dimensions }}"
# TODO(wszumski): This is a workaround for: https://bugs.launchpad.net/oslo.rootwrap/+bug/1760471
# and should be removed once we use python 3 for all distibutions.
neutron_agent_dimensions_python2:
# Values taken from TripleO: https://review.opendev.org/#/c/651137/
ulimits:
nofile:
soft: 16384
hard: 16384
neutron_agent_dimensions: >-
{{ default_container_dimensions | combine(neutron_agent_dimensions_python2 if distro_python_version | version_compare('3.0', '<') else {}) }}
neutron_dhcp_agent_dimensions: "{{ neutron_agent_dimensions }}"
neutron_l3_agent_dimensions: "{{ neutron_agent_dimensions }}"
neutron_sriov_agent_dimensions: "{{ neutron_agent_dimensions }}"
neutron_linuxbridge_agent_dimensions: "{{ neutron_agent_dimensions }}"
neutron_metadata_agent_dimensions: "{{ neutron_agent_dimensions }}"
neutron_openvswitch_agent_dimensions: "{{ neutron_agent_dimensions }}"
neutron_server_dimensions: "{{ default_container_dimensions }}"
neutron_bgp_dragent_dimensions: "{{ default_container_dimensions }}"
neutron_infoblox_ipam_agent_dimensions: "{{ default_container_dimensions }}"
neutron_openvswitch_agent_xenapi_dimensions: "{{ default_container_dimensions }}"
neutron_metering_agent_dimensions: "{{ default_container_dimensions }}"
neutron_openvswitch_agent_xenapi_dimensions: "{{ neutron_agent_dimensions }}"
neutron_metering_agent_dimensions: "{{ neutron_agent_dimensions }}"
ironic_neutron_agent_dimensions: "{{ default_container_dimensions }}"