> 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

Attachment: signature.asc
Description: OpenPGP digital signature

__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

Reply via email to