Public bug reported: Most requests to the placement service eventually reach the database code in the resource_provider.py file and as a result eventually run _ensure_trait_sync to make sure that this process has synced the os- traits library to its traits database table.
While there is a flag to make sure that the syncing doesn't happen if it already happened before, we lock around checking that flag for nearly every request. This isn't the end of the world, but it is wasted activity and it can make a lot of noise in the logs if you're running DEBUG: 2018-03-15 17:35:37.653 7 DEBUG oslo_concurrency.lockutils [req-7904bbbe-52f7-420f-b058-13779dc018d1 admin admin - - -] Acquired semaphore "trait_sync" lock /usr/lib/python3.6/site-packages/oslo_concurrency/lockutils.py:212 2018-03-15 17:35:37.653 7 DEBUG oslo_concurrency.lockutils [req-7904bbbe-52f7-420f-b058-13779dc018d1 admin admin - - -] Releasing semaphore "trait_sync" lock /usr/lib/python3.6/site-packages/oslo_concurrency/lockutils.py:228 This is redundant. I'm pretty sure I wrote this code, so I'm not sure what I was thinking, probably cargo culting off ensuring the resource classes. We only need to sync the traits to the database once and we only need to check if it has been done once per process. The traits are read from a python module that is only imported once per process. So, what we could do is move the calling of ensure_trait_sync to the part of placement that establishes the database connection facade thingie. If we merge https://review.openstack.org/#/c/541435/ (which moves placement database connection establishment to its own file) or something like it, we have an easy place to do it, at server boot time. We find the session, make a context, do the sync, set the global and never worry about it again. All the _ensure_trait_sync calls can be removed. ** Affects: nova Importance: Low Status: Triaged ** Tags: placement -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Compute (nova). https://bugs.launchpad.net/bugs/1756151 Title: placement os-traits sync checked every request Status in OpenStack Compute (nova): Triaged Bug description: Most requests to the placement service eventually reach the database code in the resource_provider.py file and as a result eventually run _ensure_trait_sync to make sure that this process has synced the os- traits library to its traits database table. While there is a flag to make sure that the syncing doesn't happen if it already happened before, we lock around checking that flag for nearly every request. This isn't the end of the world, but it is wasted activity and it can make a lot of noise in the logs if you're running DEBUG: 2018-03-15 17:35:37.653 7 DEBUG oslo_concurrency.lockutils [req-7904bbbe-52f7-420f-b058-13779dc018d1 admin admin - - -] Acquired semaphore "trait_sync" lock /usr/lib/python3.6/site-packages/oslo_concurrency/lockutils.py:212 2018-03-15 17:35:37.653 7 DEBUG oslo_concurrency.lockutils [req-7904bbbe-52f7-420f-b058-13779dc018d1 admin admin - - -] Releasing semaphore "trait_sync" lock /usr/lib/python3.6/site-packages/oslo_concurrency/lockutils.py:228 This is redundant. I'm pretty sure I wrote this code, so I'm not sure what I was thinking, probably cargo culting off ensuring the resource classes. We only need to sync the traits to the database once and we only need to check if it has been done once per process. The traits are read from a python module that is only imported once per process. So, what we could do is move the calling of ensure_trait_sync to the part of placement that establishes the database connection facade thingie. If we merge https://review.openstack.org/#/c/541435/ (which moves placement database connection establishment to its own file) or something like it, we have an easy place to do it, at server boot time. We find the session, make a context, do the sync, set the global and never worry about it again. All the _ensure_trait_sync calls can be removed. To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1756151/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp