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

Depends-On: https://review.opendev.org/807851
Change-Id: Ibf53460bd0af8048d333869ab9e7f7debb96e00a
This commit is contained in:
Grzegorz Grasza 2021-11-04 10:24:02 +01:00 committed by Takashi Kajinami
parent 0759117bd9
commit d06bc54375
3 changed files with 46 additions and 0 deletions

View File

@ -64,6 +64,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)
@ -133,6 +155,10 @@ class keystone::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,
@ -166,6 +192,10 @@ class keystone::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,

View File

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

View File

@ -23,6 +23,10 @@ describe 'keystone::cache' do
:memcache_servers => '<SERVICE DEFAULT>',
:memcache_dead_retry => '<SERVICE DEFAULT>',
:memcache_socket_timeout => '<SERVICE DEFAULT>',
:enable_socket_keepalive => '<SERVICE DEFAULT>',
:socket_keepalive_idle => '<SERVICE DEFAULT>',
:socket_keepalive_interval => '<SERVICE DEFAULT>',
:socket_keepalive_count => '<SERVICE DEFAULT>',
:memcache_pool_maxsize => '<SERVICE DEFAULT>',
:memcache_pool_unused_timeout => '<SERVICE DEFAULT>',
:memcache_pool_connection_get_timeout => '<SERVICE DEFAULT>',
@ -48,6 +52,10 @@ describe 'keystone::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',
@ -71,6 +79,10 @@ describe 'keystone::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',