diff options
author | Boris Pavlovic <boris@pavlovic.me> | 2012-12-17 13:48:28 +0400 |
---|---|---|
committer | Boris Pavlovic <boris@pavlovic.me> | 2012-12-23 06:58:36 +0400 |
commit | c3229871853ad98cb99eba5036aef0c6a5d51275 (patch) | |
tree | 17d8361916a16eb48c56d5437eccfd1e3e62f1f7 /tools/hacking.py | |
parent | 8a1843a91a98cf5b945ed97adb82c2f820438949 (diff) | |
download | nova-c3229871853ad98cb99eba5036aef0c6a5d51275.tar.gz nova-c3229871853ad98cb99eba5036aef0c6a5d51275.tar.xz nova-c3229871853ad98cb99eba5036aef0c6a5d51275.zip |
Database metadata performance optimizations
In instance_metadata_update():
Fix bug: there was no transaction in method.
Performance optimization:
let N is number of metadata items.
Was:
*) 1 request to get all (M) existing in DB entries
*) (M-L) requests to get all entries that don't exist in metadata
*) (M-L) requests to soft delete all entries
*) N request to try to get get metadata by key from DB
*) N request to save
Now:
*) 1 requst to soft delete entries that exist in DB and don't exist in metadata
*) 1 requst to get all(L) entries that exist in metadata and DB
*) L request to update all L entries that exist in DB and metadata
*) N-L request to create new entries.
result 1 + 2*(M - L + N) -> 2 + N
In instance_system_metadata_update():
Fix bug: there was no transaction in method.
Same performance situation.
In aggregate_metadata_get:
Fix bug: there was no transaction at all in method.
Performance optimization:
Let N is number of metadata items.
All request have check that Aggregate exist so each time there are 2 request.
Was:
*) 1 + 1 request to get all (M) entries that exist in DB
*) (1 + 1)*(M-L) request to get each entry that exist in DB and doesn't exist in metadata
*) (1 + 1)*(M-L) to soft delete entries
*) N * (1 + 1) try to get each item that exist in metadata
*) N * (1 + 1) update or save
Now:
*) 1 request to get query object if exist Aggregate
*) 1 request to soft delete or entries that exist in DB and doesn't exit in metadata
*) 1 request to get elements that exist in DB and in metadata
*) L request to update existing metadata
*) N - L request to create new metadata
2 + 4*(M - L) + 4*N -> 3 + N
blueprint db-session-cleanup
Change-Id: Ie14f89c567c971dece34cc3659ad3a48cf82acf6
Diffstat (limited to 'tools/hacking.py')
0 files changed, 0 insertions, 0 deletions