From 2442f70c17d95e9c4cec4e3939ef2516a8aefdd5 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Thu, 27 Jan 2022 20:30:47 +0900 Subject: [PATCH] Add socket keepalive options for the pymemcache backend This patch specifies a set of options required to setup the socket keepalive feature of pymemcache (dogpile.cache) cache backend. Original oslo.cache change: https://review.opendev.org/c/openstack/oslo.cache/+/803716 Co-Authored-By: Grzegorz Grasza Depends-On: https://review.opendev.org/807851 Change-Id: I867c5de4729eb6cead1a800c048a94c6ee9b06a1 --- manifests/cache.pp | 30 +++++++++++++++++++ ...dd_keepalive_options-7e785c5bb0d0e74e.yaml | 4 +++ spec/classes/neutron_cache_spec.rb | 12 ++++++++ 3 files changed, 46 insertions(+) create mode 100644 releasenotes/notes/add_keepalive_options-7e785c5bb0d0e74e.yaml diff --git a/manifests/cache.pp b/manifests/cache.pp index 81c145038..c82c7d29b 100644 --- a/manifests/cache.pp +++ b/manifests/cache.pp @@ -65,6 +65,28 @@ # (floating point value) # Defaults to $::os_service_default # +# [*enable_socket_keepalive*] +# (Optional) Global toggle for the socket keepalive of dogpile's +# pymemcache backend +# Defaults to $::os_service_default +# +# [*socket_keepalive_idle*] +# (Optional) The time (in seconds) the connection needs to remain idle +# before TCP starts sending keepalive probes. Should be a positive integer +# most greater than zero. +# Defaults to $::os_service_default +# +# [*socket_keepalive_interval*] +# (Optional) The time (in seconds) between individual keepalive probes. +# Should be a positive integer most greater than zero. +# Defaults to $::os_service_default +# +# [*socket_keepalive_count*] +# (Optional) The maximum number of keepalive probes TCP should send before +# dropping the connection. Should be a positive integer most greater than +# zero. +# Defaults to $::os_service_default +# # [*memcache_pool_maxsize*] # (Optional) Max total number of open connections to every memcached server. # (oslo_cache.memcache_pool backend only). (integer value) @@ -163,6 +185,10 @@ class neutron::cache ( $memcache_pool_maxsize = $::os_service_default, $memcache_pool_unused_timeout = $::os_service_default, $memcache_pool_connection_get_timeout = $::os_service_default, + $enable_socket_keepalive = $::os_service_default, + $socket_keepalive_idle = $::os_service_default, + $socket_keepalive_interval = $::os_service_default, + $socket_keepalive_count = $::os_service_default, $manage_backend_package = true, $tls_enabled = $::os_service_default, $tls_cafile = $::os_service_default, @@ -190,6 +216,10 @@ class neutron::cache ( memcache_servers => $memcache_servers, memcache_dead_retry => $memcache_dead_retry, memcache_socket_timeout => $memcache_socket_timeout, + enable_socket_keepalive => $enable_socket_keepalive, + socket_keepalive_idle => $socket_keepalive_idle, + socket_keepalive_interval => $socket_keepalive_interval, + socket_keepalive_count => $socket_keepalive_count, memcache_pool_maxsize => $memcache_pool_maxsize, memcache_pool_unused_timeout => $memcache_pool_unused_timeout, memcache_pool_connection_get_timeout => $memcache_pool_connection_get_timeout, diff --git a/releasenotes/notes/add_keepalive_options-7e785c5bb0d0e74e.yaml b/releasenotes/notes/add_keepalive_options-7e785c5bb0d0e74e.yaml new file mode 100644 index 000000000..e03e57a91 --- /dev/null +++ b/releasenotes/notes/add_keepalive_options-7e785c5bb0d0e74e.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + Add socket keepalive options for the pymemcache (dogpile.cache) backend. diff --git a/spec/classes/neutron_cache_spec.rb b/spec/classes/neutron_cache_spec.rb index ec8427662..e6c17b37c 100644 --- a/spec/classes/neutron_cache_spec.rb +++ b/spec/classes/neutron_cache_spec.rb @@ -21,6 +21,10 @@ describe 'neutron::cache' do :memcache_servers => '', :memcache_dead_retry => '', :memcache_socket_timeout => '', + :enable_socket_keepalive => '', + :socket_keepalive_idle => '', + :socket_keepalive_interval => '', + :socket_keepalive_count => '', :memcache_pool_maxsize => '', :memcache_pool_unused_timeout => '', :memcache_pool_connection_get_timeout => '', @@ -52,6 +56,10 @@ describe 'neutron::cache' do :memcache_servers => ['memcached01:11211', 'memcached02:11211'], :memcache_dead_retry => '60', :memcache_socket_timeout => '300.0', + :enable_socket_keepalive => false, + :socket_keepalive_idle => 1, + :socket_keepalive_interval => 1, + :socket_keepalive_count => 1, :memcache_pool_maxsize => '10', :memcache_pool_unused_timeout => '120', :memcache_pool_connection_get_timeout => '360', @@ -78,6 +86,10 @@ describe 'neutron::cache' do :memcache_servers => ['memcached01:11211', 'memcached02:11211'], :memcache_dead_retry => '60', :memcache_socket_timeout => '300.0', + :enable_socket_keepalive => false, + :socket_keepalive_idle => 1, + :socket_keepalive_interval => 1, + :socket_keepalive_count => 1, :memcache_pool_maxsize => '10', :memcache_pool_unused_timeout => '120', :memcache_pool_connection_get_timeout => '360',