Skip to content

Commit

Permalink
Configure nofile OS limit for memcached server role
Browse files Browse the repository at this point in the history
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
  • Loading branch information
BjoernT committed May 17, 2016
1 parent 17e0ea1 commit 5c2d8c5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions defaults/main.yml
Expand Up @@ -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
@@ -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.
16 changes: 16 additions & 0 deletions tasks/memcached_config.yml
Expand Up @@ -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"

0 comments on commit 5c2d8c5

Please sign in to comment.