keystonemiddleware/keystonemiddleware
Michal Arbet 788d3c4969 Switch to eventlet-safe oslo.cache's MemcacheClientPool
In past days there were discussions about various issues
with memcached connections [1][2][3].

After investigation it looks like common root cause for above
problems is keystonemiddleware. More precisely said the way
how keystonemiddleware is caching tokens.

Currently it's using some home-made CachePool with direct
usage of memcached library, moreover it looks like its
approach is not eventlet-safe.
Discussion can be mainly found in [4].

Fortunately keystonemiddleware can use "advanced cache pool",
which is oslo.cache's implementation and was added long time ago [5],
but it is turned on only if memcache_use_advanced_pool=True.

This patch is switching to more elaborated oslo.cache CachePool
and adding deprecation warning about eventlet-unsafe variant
of keystonemiddleware's memcache pool.

How to reproduce ?

with memcache_use_advanced_pool=False

1. Build clean ENV of openstack
2. Deploy core projects (keystone,glance,nova,placement...)
3. Run while true; do COMMAND FOR SERVICE; done
   - several bashes, in parallel (5-7)

COMMAND FOR SERVICE:
- openstack network list
- openstack volume list
- openstack server list
- openstack image list

4. Check memcached connections (which will grow up):
    - ss | grep 11211 | wc -l   every second

How to fix and test it ?

Repeat above, to fix:
 - with memcache_use_advanced_pool=True
   OR
 - apply this patch

Compare measurements in graph.

[1] https://bugs.launchpad.net/keystonemiddleware/+bug/1892852
[2] https://bugs.launchpad.net/oslo.cache/+bug/1888394
[3] https://bugs.launchpad.net/keystonemiddleware/+bug/1883659

[4] https://review.opendev.org/c/openstack/oslo.cache/+/742193

[5] https://review.opendev.org/c/openstack/keystonemiddleware/+/268664

Closes-Bug: #1883659
Closes-Bug: #1892852
Closes-Bug: #1888394

Change-Id: I0e96334b65a0bf369ebf1d88651d13feb8d2ecac
2021-02-11 14:36:25 +00:00
..
_common Fix misspell word 2019-09-09 09:02:14 +08:00
audit Make sure audit middleware use own context 2018-12-24 02:02:17 +00:00
auth_token Switch to eventlet-safe oslo.cache's MemcacheClientPool 2021-02-11 14:36:25 +00:00
echo Replace six.iteritems() with .items() 2017-07-12 13:43:55 +07:00
locale Imported Translations from Zanata 2019-12-22 07:08:56 +00:00
tests Merge "Use unittest.mock instead of third party mock" 2020-08-24 19:38:38 +00:00
__init__.py Moving middleware to new location 2014-06-19 15:50:41 -07:00
ec2_token.py Change ec2 URLs to v3 2019-11-29 04:20:14 +00:00
exceptions.py Create a Config object 2016-06-10 18:21:56 +00:00
fixture.py Remove use of positional decorator 2017-08-07 13:18:19 -07:00
i18n.py Update URLs in documentation 2017-07-20 16:38:16 +08:00
opts.py Move auth token opts calculation into auth_token 2016-06-13 14:03:23 -03:00
s3_token.py Rename auth_uri to www_authenticate_uri 2017-10-11 14:00:49 +02:00