[openstack-dev] In memory joins in Nova

Dan Smith dms at danplanet.com
Tue Aug 11 23:29:16 UTC 2015


> Here are a few --
> instance_get_all_by_filters joins manually with 
> instances_fill_metadata --
> https://github.com/openstack/nova/blob/master/nova/db/sqlalchemy/api.py#L1890
> https://github.com/openstack/nova/blob/master/nova/db/sqlalchemy/api.py#L1782
> 
> Almost all instance query functions manually join with instance_metadata.

This was done because joining metadata with instances was resulting in
very large result sets from the database. Instance objects are very
large, and each can have many rows in the metadata tables (especially in
older versions of nova). When joining these tables and doing queries for
all instances on a host or across a time interval, the result sets are
very large (we had a big issue with this at the grizzly release, as
reported by real deployments). So, we're trading some overhead (and
atomicity) for significantly lower DB traffic.

I don't think this is likely to be the source of your measured CPU
overhead though. The metadata joining is O(n) where n is the number of
instances in the result. I would think that is much smaller than the
overhead of processing the result of the query into ORM objects.

--Dan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20150811/1acdd36e/attachment.pgp>


More information about the OpenStack-dev mailing list