The get_own_shard_range() method is called during every container GET or HEAD request (as well as at other times). The method delegates to get_shard_ranges() which queries the DB for shard ranges. Although the query has conditions to only select a single shard range name, and the method will return only the first matching shard range, the query had no LIMIT. Adding a LIMIT of 1 significantly reduces execution time when the DB has many shard range rows. On the author's machine, using a DB with ~12000 shard ranges this patch reduces the get_own_shard_range() execution time by a factor of approximately 100. Change-Id: I43f79de3f0603b9fab8bf6f7b4c3b1892a8919b3
304 KiB
304 KiB