<div dir="ltr"><div>Hey all,</div><div>    During the Cinder and Manila's cross project discussion on quota system last week, I raise our concern of performance impact on the count resource feature, and Gorka pointed out we might miss some of the indexes when testing. So I reshaped the environment and share some test results here as below:</div><div><br></div><div><b>Test patch:</b></div><div>     Basically this [1] is borrowed from Nova for Cinder, and only the create volume process has been updated to use the new system.</div><div><br></div><div><b>Test Environment on AWS:</b></div><div>    1. 3 EC2 t2.large(2 vCPU, 8GiB,80G SSD) each one deployed cinder API service with 10 api workers (coordinated by haproxy)</div><div>    2. 1 RDS db.m4.xlarge(4 vCPU, 16GiB,200G SSD) MySQL 5.7.19</div><div><br></div><div><b>Database upgrade:</b></div><div>Composite index has been added to volume table (volumes__composite_index):</div><div><span style="white-space:pre">         </span>+---------+------------+--------------------------+--------------+---------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+</div><div><span style="white-space:pre">          </span>| Table   | Non_unique | Key_name                      | Seq_in_index | Column_name         | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |</div><div><span style="white-space:pre">             </span>+---------+------------+--------------------------+--------------+---------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+</div><div><span style="white-space:pre">          </span>|   .....other index.......     |</div><div><span style="white-space:pre">          </span>| volumes |                 1 | volumes__composite_index |             1 | project_id          | A         |           2 |     NULL | NULL   | YES  | BTREE      |         |               |</div><div><span style="white-space:pre">            </span>| volumes |                 1 | volumes__compoite_index |               2 | deleted             | A         |           2 |     NULL | NULL   | YES  | BTREE      |         |               |</div><div><span style="white-space:pre">         </span>| volumes |                 1 | volumes__composite_index |             3 | volume_type_id      | A         |           2 |     NULL | NULL   | YES  | BTREE      |         |               |</div><div><span style="white-space:pre">              </span>+---------+------------+--------------------------+--------------+---------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+</div><div> Explain result for one of the sql statements for new quota system (<i>explain select count(*), sum(size) from volumes where project_id={project_id} and volume_type_id={type_id} and deleted=false</i>):</div><div><span style="white-space:pre">     </span>       +----+-------------+---------+------------+------+--------------------------+--------------------------+---------+-------------------+------+----------+-------+</div><div><span style="white-space:pre">           </span>| id | select_type | table   | partitions | type | possible_keys            | key                      | key_len | ref               | rows | filtered | Extra |</div><div><span style="white-space:pre">     </span>       +----+-------------+---------+------------+------+--------------------------+--------------------------+---------+-------------------+------+----------+-------+</div><div><span style="white-space:pre">           </span>|  1 | SIMPLE      | volumes | NULL       | ref  | volumes__composite_index | volumes__composite_index | 881     | const,const,const |    1 |   100.00 | NULL  |</div><div><span style="white-space:pre">        </span>       +----+-------------+---------+------------+------+--------------------------+--------------------------+---------+-------------------+------+----------+-------+</div><div><br></div><div><b>Time comparsion between two system (in Seconds, </b> <b>Conc = Concurrency</b><b>):</b></div><div><b><br></b></div><div><p class="MsoNormal" style="color:rgb(33,33,33);font-size:13px"><span lang="EN-US" style="font-family:微软雅黑,sans-serif;color:black"><b>NOTE</b></span><span lang="EN-US" style="font-family:"Helvetica LT Std Light",sans-serif;color:black"><b>:</b><u></u><u></u></span></p><p class="MsoNormal" style="color:rgb(33,33,33);font-size:13px"><span lang="EN-US" style="font-family:"Helvetica LT Std Light",sans-serif;color:black">      1. <b>QUOTAS.check_deltas</b>  stands for the total time consumed including two sql statements as below when creating single volume:<u></u><u></u></span></p><p class="MsoNormal" style="color:rgb(33,33,33);font-size:13px"><span lang="EN-US" style="font-family:"Helvetica LT Std Light",sans-serif;color:black">          1. SELECT count(id), sum(size) from volumes where project_id=$(project_id) and deleted=False<u></u><u></u></span></p><p class="MsoNormal" style="color:rgb(33,33,33);font-size:13px"><span lang="EN-US" style="font-family:"Helvetica LT Std Light",sans-serif;color:black">          2. SELECT count(id), sum(size) from volumes where project_id=$(project_id) and deleted=False and volume_type=$(volume_type)<u></u><u></u></span></p><p class="MsoNormal" style="color:rgb(33,33,33);font-size:13px"><span lang="EN-US" style="font-family:"Helvetica LT Std Light",sans-serif;color:black">      2. <b>Quota Reserve/Quota Commit</b> stands for total time consumed when executing QUOTA.reserve and QUOTA.commit.</span></p></div><div><br></div><div>1. Create 1000 volumes in tenant which has <b>10000</b> records in database and <b>180000 </b>undeleted records in total:</div><div><img src="cid:16209b99ceecb971f163" alt="image.png" class="" style="max-width: 100%; opacity: 1;"></div><div>2.  Create 1000 volumes in tenant which has <b>20000</b> records in database and <b>180000 </b>undeleted records in total:</div><div><br></div><div><img src="cid:16209bbcd29cb971f164" alt="image.png" class="" style="max-width: 100%; opacity: 1;"><br></div><div>3.  Create 1000 volumes in tenant which has <b>30000</b> records in database and <b>180000 </b>undeleted records in total:  <br></div><div><img src="cid:16209c36277cb971f165" alt="image.png" class="" style="max-width: 100%; opacity: 1;"><br></div><div>4.  Create 1000 volumes in tenant which has<b> 40000</b> records in database and <b>180000 </b>undeleted records in total:    <br></div><div><br></div><div><img src="cid:16209c7983dcb971f167" alt="image.png" class="" style="max-width: 100%; opacity: 1;"><br></div><div>5.  Create 1000 volumes in tenant which has<b> 60000</b> records in database and <b>180000 </b>undeleted records in total:      <br></div><div><img src="cid:16209cbddeecb971f168" alt="image.png" class="" style="max-width: 100%; opacity: 1;"><br></div><div>I only posted some of the test results here, but in general, the new system will become slower when the amount of concurrency or existing volumes in tenant keeps raising.  Also it seems our current quota system will always beat the new one in performance when there are about <b>30000 </b>volumes in tenant.</div><div><br></div><div>I am a little worried about the performance impact if we replace our current design with count resource feature, and I could be wrong, maybe I missed something important during testing, please let me know if you have any idea or suggestion.</div><div><br></div><div>Thanks</div><div>TommyLike</div><div><br></div><div>[1]: <a href="https://review.openstack.org/#/c/536341/">https://review.openstack.org/#/c/536341/</a></div></div>