From 5c2d8c55ec51bee993d134aa9d4484879b762d62 Mon Sep 17 00:00:00 2001 From: Bjoern Teipel Date: Mon, 16 May 2016 11:48:53 -0500 Subject: [PATCH] Configure nofile OS limit for memcached server role This fix adds a new override `memcached_connections` which is automatically calculated from the number of memcached connection limit plus additional 1k to configure the OS nofile limit. Without proper nofile limit configuration, memcached will crash in order to support higher parallel connection TCP/Memcache counts. Closes-Bug: #1582288 Change-Id: I558ba329b7247cdfcf660e392c3ae0c4a0d65a53 --- defaults/main.yml | 1 + ...rver-add-nofile-setting-504e0c50e10a4ea6.yaml | 9 +++++++++ tasks/memcached_config.yml | 16 ++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 releasenotes/notes/memcached_server-add-nofile-setting-504e0c50e10a4ea6.yaml diff --git a/defaults/main.yml b/defaults/main.yml index fd70116..3c2b583 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -35,6 +35,7 @@ memcached_listen: "127.0.0.1" memcached_log: /var/log/memcached/memcached.log memcached_connections: 1024 memcached_threads: 4 +memcached_file_limits: "{{ memcached_connections | int + 1024 }}" memcached_apt_packages: - memcached diff --git a/releasenotes/notes/memcached_server-add-nofile-setting-504e0c50e10a4ea6.yaml b/releasenotes/notes/memcached_server-add-nofile-setting-504e0c50e10a4ea6.yaml new file mode 100644 index 0000000..daedb68 --- /dev/null +++ b/releasenotes/notes/memcached_server-add-nofile-setting-504e0c50e10a4ea6.yaml @@ -0,0 +1,9 @@ +--- +features: + - The openstack-ansible-memcached_server role includes + a new override,`memcached_connections` which is + automatically calculated from the number of memcached + connection limit plus additional 1k to configure + the OS nofile limit. Without proper nofile limit + configuration, memcached will crash in order to support + higher parallel connection TCP/Memcache counts. diff --git a/tasks/memcached_config.yml b/tasks/memcached_config.yml index 3436cc3..7a01421 100644 --- a/tasks/memcached_config.yml +++ b/tasks/memcached_config.yml @@ -41,3 +41,19 @@ notify: Restart memcached tags: - memcached-config + +- name: Configure soft file limits + lineinfile: + dest: "/etc/security/limits.conf" + regexp: "^memcache.*soft.*nofile.*" + state: "present" + line: "memcache\tsoft\tnofile\t\t{{ memcached_file_limits }}" + insertbefore: "^# End of file" + +- name: Configure hard file limits + lineinfile: + dest: "/etc/security/limits.conf" + regexp: "^memcache.*hard.*nofile.*" + state: "present" + line: "memcache\thard\tnofile\t\t{{ memcached_file_limits }}" + insertbefore: "^# End of file"