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
(cherry picked from commit 5c2d8c55ec)
This commit is contained in:
Bjoern Teipel 2016-05-16 11:48:53 -05:00
parent 7f2ff30347
commit 045b2d8f54
3 changed files with 26 additions and 0 deletions

View File

@ -31,6 +31,7 @@ memcached_listen: "127.0.0.1"
memcached_log: /var/log/memcached.log
memcached_connections: 1024
memcached_threads: 4
memcached_file_limits: "{{ memcached_connections | int + 1024 }}"
memcached_apt_packages:
- memcached

View File

@ -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.

View File

@ -36,3 +36,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"