The performance of /v2/recordsets API was found slow when filtering on large amount of recordsets. The patch proposes the following ways to improve the performance, and was tested with 1M recordsets. 1. To explicitly mention a correct table index in sql queries for different sort keys and filtering keys. We found mysql optimizer is not able to choose the most suitable index; 2. Introduce a new header 'OpenStack-DNS-Hide-Counts' to give operators the flexibility of showing total_count or not, because we found that the count query does not scale well on a large amount of records. Performance results are at: https://gist.github.com/jamesyli/2eb9fb474a493477a9beb42fe122180f DB migration Change-Id: I7f3a09ce2c7396ff6ad02d3b5d562d186f66ed30changes/13/328813/8
parent
addc6b0df8
commit
f40681c3df
@ -0,0 +1,36 @@
|
||||
# Copyright 2016 Rackspace
|
||||
#
|
||||
# Author: James Li <james.li@rackspace.com>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
from oslo_log import log as logging
|
||||
from sqlalchemy.schema import MetaData, Table, Index
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
meta = MetaData()
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
meta.bind = migrate_engine
|
||||
recordsets_table = Table('recordsets', meta, autoload=True)
|
||||
|
||||
Index('rrset_updated_at', recordsets_table.c.updated_at
|
||||
).create(migrate_engine)
|
||||
Index('rrset_zoneid', recordsets_table.c.zone_id
|
||||
).create(migrate_engine)
|
||||
Index('rrset_type', recordsets_table.c.type).create(migrate_engine)
|
||||
Index('rrset_ttl', recordsets_table.c.ttl).create(migrate_engine)
|
||||
Index('rrset_tenant_id', recordsets_table.c.tenant_id
|
||||
).create(migrate_engine)
|
Loading…
Reference in new issue