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.

Depends-On: https://review.opendev.org/803716
Change-Id: I7deed1bca1ce2f715967e966d4b0cedc1f227027
(cherry picked from commit 60495a42c9)
(cherry picked from commit ba251d3e2d)
(cherry picked from commit 02f7cc8a8f)
(cherry picked from commit dc42ef8ed7)
This commit is contained in:
Grzegorz Grasza 2021-09-08 12:16:11 +02:00 committed by Hervé Beraud
parent bcab43d802
commit ab10d814a0
3 changed files with 46 additions and 0 deletions

View File

@ -97,6 +97,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*]
# Max total number of open connections to every memcached server.
# (oslo_cache.memcache_pool backend only). (integer value)
@ -161,6 +183,10 @@ define oslo::cache(
$memcache_servers = $::os_service_default,
$memcache_dead_retry = $::os_service_default,
$memcache_socket_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,
$memcache_pool_maxsize = $::os_service_default,
$memcache_pool_unused_timeout = $::os_service_default,
$memcache_pool_connection_get_timeout = $::os_service_default,
@ -218,6 +244,10 @@ define oslo::cache(
'cache/memcache_servers' => { value => $memcache_servers_orig },
'cache/memcache_dead_retry' => { value => $memcache_dead_retry },
'cache/memcache_socket_timeout' => { value => $memcache_socket_timeout },
'cache/enable_socket_keepalive' => { value => $enable_socket_keepalive },
'cache/socket_keepalive_idle' => { value => $socket_keepalive_idle },
'cache/socket_keepalive_interval' => { value => $socket_keepalive_interval },
'cache/socket_keepalive_count' => { value => $socket_keepalive_count },
'cache/memcache_pool_maxsize' => { value => $memcache_pool_maxsize },
'cache/memcache_pool_unused_timeout' => { value => $memcache_pool_unused_timeout },
'cache/memcache_pool_connection_get_timeout' => { value => $memcache_pool_connection_get_timeout },

View File

@ -0,0 +1,4 @@
---
features:
- |
Add socket keepalive options for the pymemcache (dogpile.cache) backend.

View File

@ -18,6 +18,10 @@ describe 'oslo::cache' do
is_expected.to contain_keystone_config('cache/memcache_servers').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/memcache_dead_retry').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/memcache_socket_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/enable_socket_keepalive').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/socket_keepalive_idle').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/socket_keepalive_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/socket_keepalive_count').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/memcache_pool_maxsize').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/memcache_pool_unused_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/memcache_pool_connection_get_timeout').with_value('<SERVICE DEFAULT>')
@ -42,6 +46,10 @@ describe 'oslo::cache' do
:memcache_servers => ['host1:11211', 'host2:11211','[fd12:3456:789a:1::1]:11211'],
:memcache_dead_retry => '300',
:memcache_socket_timeout => '3.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 => '60',
:memcache_pool_connection_get_timeout => '10',
@ -64,6 +72,10 @@ describe 'oslo::cache' do
is_expected.to contain_keystone_config('cache/memcache_servers').with_value('host1:11211,host2:11211,inet6:[fd12:3456:789a:1::1]:11211')
is_expected.to contain_keystone_config('cache/memcache_dead_retry').with_value('300')
is_expected.to contain_keystone_config('cache/memcache_socket_timeout').with_value('3.0')
is_expected.to contain_keystone_config('cache/enable_socket_keepalive').with_value('false')
is_expected.to contain_keystone_config('cache/socket_keepalive_idle').with_value('1')
is_expected.to contain_keystone_config('cache/socket_keepalive_interval').with_value('1')
is_expected.to contain_keystone_config('cache/socket_keepalive_count').with_value('1')
is_expected.to contain_keystone_config('cache/memcache_pool_maxsize').with_value('10')
is_expected.to contain_keystone_config('cache/memcache_pool_unused_timeout').with_value('60')
is_expected.to contain_keystone_config('cache/memcache_pool_connection_get_timeout').with_value('10')