designate/tools/mysql_pending_notify_bench
Federico Ceratto ecda910c2b Add delayed NOTIFY
Based on specs in https://review.openstack.org/#/c/246515
Add database column zones.pending_notify and migration script
Add Zone Manager Task to perform delayed NOTIFY
Add Admin API method to count zones pending notify

closes-bug: #1498462
partial-bug: #1436210
Change-Id: Ic5c2745bcd2cc057a42cb8edf21ed4c1a3ddc952
Depends-On: If15594099eb7cf74f1c534a05884c2d2501e57e6
2016-02-17 15:24:00 +00:00
..
README Add delayed NOTIFY 2016-02-17 15:24:00 +00:00
runner Add delayed NOTIFY 2016-02-17 15:24:00 +00:00

A simple benchmark was run on 2015-11-24 to measure the effectiveness of adding an index on pending_notify

$ sudo ./runner
Creating DB and table
Populating non-pending rows
Populating pending rows
+-----------+
| COUNT(id) |
+-----------+
|      5000 |
+-----------+
+-----------+
| COUNT(id) |
+-----------+
|    200000 |
+-----------+
Without any index
+----+-------------+-------+------+---------------+------+---------+------+--------+-----------------------------+
| id | select_type | table | type | possible_keys | key  | key_len | ref  | rows   | Extra                       |
+----+-------------+-------+------+---------------+------+---------+------+--------+-----------------------------+
|  1 | SIMPLE      | zones | ALL  | NULL          | NULL | NULL    | NULL | 204013 | Using where; Using filesort |
+----+-------------+-------+------+---------------+------+---------+------+--------+-----------------------------+
Benchmark
	Average number of seconds to run all queries: 0.137 seconds
	Minimum number of seconds to run all queries: 0.122 seconds
	Maximum number of seconds to run all queries: 0.158 seconds
	Number of clients running queries: 3
	Average number of queries per client: 1

With pending_notify index
+----+-------------+-------+------+--------------------+--------------------+---------+-------+------+-----------------------------+
| id | select_type | table | type | possible_keys      | key                | key_len | ref   | rows | Extra                       |
+----+-------------+-------+------+--------------------+--------------------+---------+-------+------+-----------------------------+
|  1 | SIMPLE      | zones | ref  | pending_notify_idx | pending_notify_idx | 2       | const | 4999 | Using where; Using filesort |
+----+-------------+-------+------+--------------------+--------------------+---------+-------+------+-----------------------------+
Benchmark
	Average number of seconds to run all queries: 0.012 seconds
	Minimum number of seconds to run all queries: 0.010 seconds
	Maximum number of seconds to run all queries: 0.019 seconds
	Number of clients running queries: 3
	Average number of queries per client: 1

With created_at and pending_notify index
+----+-------------+-------+------+--------------------+--------------------+---------+-------+------+-----------------------------+
| id | select_type | table | type | possible_keys      | key                | key_len | ref   | rows | Extra                       |
+----+-------------+-------+------+--------------------+--------------------+---------+-------+------+-----------------------------+
|  1 | SIMPLE      | zones | ref  | pending_notify_idx | pending_notify_idx | 2       | const | 4999 | Using where; Using filesort |
+----+-------------+-------+------+--------------------+--------------------+---------+-------+------+-----------------------------+
Benchmark
	Average number of seconds to run all queries: 0.012 seconds
	Minimum number of seconds to run all queries: 0.010 seconds
	Maximum number of seconds to run all queries: 0.018 seconds
	Number of clients running queries: 3
	Average number of queries per client: 1