Order filters by cost

Sean Mooney smooney at redhat.com
Thu Nov 14 22:44:46 UTC 2019

On Thu, 2019-11-14 at 21:44 +0000, Albert Braden wrote:
> I'm working on a list of filters ordered by cost. This is what I have so far. Does this look reasonably correct for
> Rocky?
some comments in line but more or less yes.
also the best thing you can do is disable filters you dont need.
> Cheap Filters:
> AllHostsFilter - does no filtering. It passes all the available hosts.
> AvailabilityZoneFilter - filters hosts by availability zone.
> AggregateInstanceExtraSpecsFilter - checks aggregate metadata set with aggregate_instance_extra_specs.  All hosts are
> passed if no extra_specs are specified.
the AggregateInstanceExtraSpecsFilter is actually expensive in some cases as it has to get the aggreate metadata for
each aggreate the hosts is a member of and then compare the flavor extra specs to the metadata specifid in those
aggrates so this get expssive as the numaber of aggreates a host is a member of grows. the worst case sclaing for this
in NxM where N is the number of hosts an M is the maxium number of aggates a host is a part of. in other words this
scales in quadratic complexity. fortunately that is the worst case but its generally liniar.

Thinking about it a little more the aggreate filters below also have the same upper bound but in generaly most hosts
are in 1 aggreated so it remains liniar.
> AggregateCoreFilter - filters hosts by CPU core number with per-aggregate cpu_allocation_ratio setting.
> AggregateRamFilter - filters hosts by RAM with per-aggregate ram_allocation_ratio setting.
> AggregateDiskFilter - filters hosts by disk allocation with per-aggregate disk_allocation_ratio setting.
strictly speaking in rocky the 3 filter above are not deprecated yet but they are in train.
the reason they werent deprecacated sooner was we forgot when we deprecated the non aggregate versions.
so you shoudl ideally avoid useign those.

> AggregateNumInstancesFilter - filters hosts by number of instances with per-aggregate max_instances_per_host setting.
this is pretty cheap i hope to eventurally replace this with placment eventurally.

> AggregateIoOpsFilter - filters hosts by I/O operations with per-aggregate max_io_ops_per_host setting.
> AggregateMultiTenancyIsolation - isolate tenants in specific aggregates.
> AggregateTypeAffinityFilter - limits instance_type by aggregate.
> AggregateImagePropertiesIsolation - isolates hosts based on image properties and aggregate metadata.
this is more or less the same as the AggregateInstanceExtraSpecsFilter in terms of cost
> DifferentHostFilter - allows the instance on a different host from a set of instances.
> SameHostFilter - puts the instance on the same host as another instance in a set of instances.

> ComputeFilter - passes all hosts that are operational and enabled.
> NumInstancesFilter - filters compute nodes by number of running instances.
> IoOpsFilter - filters hosts by concurrent I/O operations.
> More Expensive Filters:
> ServerGroupAntiAffinityFilter - This filter implements anti-affinity for a server group.
> ServerGroupAffinityFilter - This filter works the same way as ServerGroupAntiAffinityFilter. The difference is that
> when you create the server group, you should specify a policy of 'affinity'.
> ImagePropertiesFilter - filters hosts based on properties defined on the instance's image. Doc on setting image
> properties is here: https://docs.openstack.org/glance/rocky/admin/useful-image-properties.html
> IsolatedHostsFilter - filter based on isolated_images, isolated_hosts and restrict_isolated_hosts_to_isolated_images
> flags.
> SimpleCIDRAffinityFilter - allows a new instance on a host within the same IP block.
> MetricsFilter - filters hosts based on metrics weight_setting.
> Most Expensive Filters:
my gut feeling is both the AggregateInstanceExtraSpecsFilter and AggregateImagePropertiesIsolation would be here for non
simple cases but if you keep things pretty lininar it would be in the group above because it does are resonably number
of comparisons and may be non liniar. 
> PciPassthroughFilter - Filter that schedules instances on a host if the host has devices to meet the device requests
> in the 'extra_specs' for the flavor.
> ComputeCapabilitiesFilter - checks that the capabilities provided by the host compute service satisfy any extra
> specifications associated with the instance type.
> NUMATopologyFilter - filters hosts based on the NUMA topology requested by the instance, if any.
> JsonFilter - allows simple JSON-based grammar for selecting hosts.
> Deprecated Filters:
> Please don't use any of these; they are obsolete in Rocky:
> RetryFilter - filters hosts that have already been attempted for scheduling. Obsolete since Queens.
> RamFilter - filters hosts by their RAM. Obsolete since Pike.
> CoreFilter - filters based on CPU core utilization. Obsolete since Pike.
> DiskFilter - filters hosts by their disk allocation. Obsolete since Pike.

More information about the openstack-discuss mailing list