nova/nova
melanie witt f4159d1755 Cache database and message queue connection objects
Recently in the gate we have seen a trace on some work-in-progress
patches:

  OperationalError: (pymysql.err.OperationalError)
                    (1040, u'Too many connections')

and at least one operator has reported that the number of database
connections increased significantly going from Mitaka to Newton.

It was suspected that the increase was caused by creating new oslo.db
transaction context managers on-the-fly when switching database
connections for cells. Comparing the dstat --tcp output of runs of the
gate-tempest-dsvm-neutron-full-ubuntu-xenial job with and without
caching of the database connections showed a difference of 445 active
TCP connections and 1495 active TCP connections, respectively [1].

This adds caching of the oslo.db transaction context managers and the
oslo.messaging transports to avoid creating a large number of objects
that are not being garbage-collected as expected.

Closes-Bug: #1691545

[1] https://docs.google.com/spreadsheets/d/1DIfFfX3kaA_SRoCM-aO7BN4IBEShChXLztOBFeKryt4/edit?usp=sharing

 Conflicts:
	nova/context.py
	nova/tests/unit/test_context.py

NOTE(melwitt): Conflicts caused by the fact that the set_target_cell
function doesn't exist in Ocata and message queue connections were
not stored on the context in Ocata.

Change-Id: I17e0eb836dd87aac5859f506e7d771d42753d31a
(cherry picked from commit 47fa88d947)
2017-05-19 21:54:25 +00:00
..
CA
api Merge "Fix unspecified bahavior on GET /servers/detail?tenant_id=X as admin" into stable/ocata 2017-03-08 12:33:09 +00:00
cells Remove straggling use of main db flavors in cellsv1 code 2017-02-11 18:54:48 +00:00
cert Integrate OSProfiler and Nova 2017-01-18 15:00:14 +07:00
cloudpipe Rename security_group parameter in compute.API:create 2016-11-10 11:25:43 -05:00
cmd Allow nova-status to work with custom ca for placement 2017-02-23 14:12:30 +00:00
common cors: update default configuration in config 2016-11-05 20:17:42 -04:00
compute Decrement quota usage when deleting an instance in cell0 2017-03-13 18:45:12 -04:00
conductor Fix missing instance.delete notification 2017-03-13 15:02:06 -04:00
conf Merge "Correctly set up deprecation warning" into stable/ocata 2017-03-14 19:41:23 +00:00
console Merge "tests: Replace use of CONF with monkey patching" 2017-01-24 12:03:07 +00:00
consoleauth Integrate OSProfiler and Nova 2017-01-18 15:00:14 +07:00
db Ignore deleted services in minimum version calculation 2017-02-27 12:10:02 -05:00
hacking [2/3]Replace six.iteritems() with .items() 2017-01-09 09:11:00 +00:00
image Merge "[2/3]Replace six.iteritems() with .items()" 2017-01-21 06:55:52 +00:00
ipv6
keymgr Deprecate barbican options 2016-07-29 15:36:28 -05:00
locale Imported Translations from Zanata 2016-10-27 08:19:38 +00:00
network Merge "os-vif: convert libvirt driver to use os-vif for fast path vhostuser" 2017-01-23 23:32:07 +00:00
notifications Merge "[2/3]Replace six.iteritems() with .items()" 2017-01-21 06:55:52 +00:00
objects Fix live migrate with XenServer 2017-02-16 12:47:09 -05:00
pci [2/3]Replace six.iteritems() with .items() 2017-01-09 09:11:00 +00:00
policies Separate CRUD policy for server_groups 2016-11-21 11:43:13 -05:00
scheduler Use the keystone session loader in the placement reporting 2017-02-22 16:45:13 -05:00
servicegroup Don't use 'updated_at' to check service's status 2016-12-08 09:51:03 +00:00
tests Cache database and message queue connection objects 2017-05-19 21:54:25 +00:00
virt Merge "Ensure that instance directory is removed after success migration/resize" into stable/ocata 2017-03-13 16:30:21 +00:00
vnc
volume Add service_token for nova-cinder interaction 2017-01-11 15:49:16 +00:00
wsgi Clarify the language in the apache wsgi sample 2017-02-02 15:43:25 -08:00
__init__.py
availability_zones.py Port test_metadata to Python 3 2016-11-29 11:28:24 +08:00
baserpc.py
block_device.py Allow None for block_device_mapping_v2.boot_index 2017-02-09 15:20:06 +00:00
cache_utils.py
config.py Integrate OSProfiler and Nova 2017-01-18 15:00:14 +07:00
context.py Cache database and message queue connection objects 2017-05-19 21:54:25 +00:00
crypto.py
debugger.py
exception.py Merge "Block starting compute unless placement conf is provided" 2017-01-31 20:43:44 +00:00
exception_wrapper.py [2/3]Replace six.iteritems() with .items() 2017-01-09 09:11:00 +00:00
filters.py
hash_ring.py Ironic: allow multiple compute services 2016-08-04 23:51:13 +00:00
hooks.py
i18n.py
loadables.py
manager.py Integrate OSProfiler and Nova 2017-01-18 15:00:14 +07:00
policy.py [2/3]Replace six.iteritems() with .items() 2017-01-09 09:11:00 +00:00
profiler.py Integrate OSProfiler and Nova 2017-01-18 15:00:14 +07:00
quota.py [2/3]Replace six.iteritems() with .items() 2017-01-09 09:11:00 +00:00
rpc.py Added instance.reboot.error to the legacy notifications 2017-01-27 19:15:41 +00:00
safe_utils.py
service.py Integrate OSProfiler and Nova 2017-01-18 15:00:14 +07:00
service_auth.py Add service_token for nova-cinder interaction 2017-01-11 15:49:16 +00:00
signature_utils.py
test.py Cache database and message queue connection objects 2017-05-19 21:54:25 +00:00
utils.py Merge "[2/3]Replace six.iteritems() with .items()" 2017-01-21 06:55:52 +00:00
version.py
weights.py
wsgi.py [2/3]Replace six.iteritems() with .items() 2017-01-09 09:11:00 +00:00