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 <xek@redhat.com>
Depends-On: https://review.opendev.org/807851
Change-Id: I867c5de4729eb6cead1a800c048a94c6ee9b06a1
This commit is contained in:
Takashi Kajinami 2022-01-27 20:30:47 +09:00
parent 9664dbf907
commit 2442f70c17
3 changed files with 46 additions and 0 deletions

View File

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

View File

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

View File

@ -21,6 +21,10 @@ describe 'neutron::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>',
@ -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',