Prioritize-Database-Queries

'Prioritizing Openstack Database Queries'

Objective: Higher priority queries that are generated by nova core services should be executed without any delay.

Detail Description: As there are lot of database operations happening more frequently for some services like measuring and monitoring services (Healthnmon, Ceilometer etc), there are chances of queries for core services getting delayed. The purpose is to allow higher priority queries specifically that are generated from core services should be executed without any interruption.

To achieve this objective, all the database queries should come to a single place and should be classified into multiple levels. Queries from lower level should be picked only when there are no query left in upper level. The intention of classifying into multiple levels is to ensure the high priority queries should not be affected due to large number of less priority queries of different services.

Core services like nova, glance, scheduler and more frequent used service like keystone can be in the top level. Services that are essentials but that have alternate option for the same purpose or may not be used always can be put in second categories. Services related to network and storage like Neutron, Cinder, Swift can be under this category. There are some services that perform database operations very frequently through write/update queries. However they may not access the data so frequently for their use-cases. Queries coming from these services can afford to wait and allow higher priority queries to get executed. Services like Ceilometer, Healthnmon, Horizon, Heat etc can remain in this level.

There should be a component named "Query-Balancer" to perform the desired objective. All the database queries should go though this service. Instead of accessing sqlalchemy library, queries coming from different services should send request to this service and it should execute the query on behalf of them. Query-Balancer should keep the requests in multiple queues and execute them based on their priorities. Since there are some services that now interact with the database directly using sqlalchemy library, the proposed service should be placed right above sqlalchemy library level on stack as it might miss some queries if it is placed above. This module can be placed in conductor package and executed as part of conductor service.