Bug #77170 Setting innodb_thread_concurrency to 0 dynamically can result in limited perform
Submitted: 27 May 2015 11:11 Modified: 8 Oct 2015 7:08
Reporter: Nilnandan Joshi Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.6.24, 5.6.27 OS:Any
Assigned to: CPU Architecture:Any

[27 May 2015 11:11] Nilnandan Joshi
Description:
On startup with concurrency = 0, I see no queued queries. However, if I set the concurrency to a positive integer and then set it _back_ to 0, I see queries still getting queued.

Originally Based on https://bugs.launchpad.net/percona-server/+bug/1457459

How to repeat:
Run sysbench with 

nilnandan.joshi@bm-support01:~$ sysbench --test=/usr/share/doc/sysbench/tests/db/oltp.lua --oltp-table-size=100000 --mysql-db=dbtest --mysql-user=root --mysql-password=msandbox --mysql-socket=/tmp/mysql_sandbox5624.sock prepare
sysbench 0.5:  multi-threaded system evaluation benchmark

Creating table 'sbtest1'...
Inserting 100000 records into 'sbtest1'
nilnandan.joshi@bm-support01:~$ 
nilnandan.joshi@bm-support01:~$ sysbench --test=/usr/share/doc/sysbench/tests/db/oltp.lua --oltp-table-size=100000 --oltp-test-mode=complex --oltp-read-only=off --num-threads=32 --max-time=120 --max-requests=0 --mysql-db=dbtest --mysql-user=root --mysql-password=msandbox --mysql-socket=/tmp/mysql_sandbox5624.sock run

and check in MySQL, 

nilnandan.joshi@bm-support01:~$ mysql -uroot -p --socket=/tmp/mysql_sandbox5624.sock
Warning: Using unique option prefix pass instead of password is deprecated and will be removed in a future release. Please use the full name instead.
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.6.24 MySQL Community Server (GPL)

Copyright (c) 2009-2015 Percona LLC and/or its affiliates
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> pager grep -A6 "ROW OPERATIONS"
PAGER set to 'grep -A6 "ROW OPERATIONS"'
mysql> 
mysql> set global innodb_thread_concurrency=0;
Query OK, 0 rows affected (0.00 sec)

mysql> show engine innodb status\G
ROW OPERATIONS
--------------
0 queries inside InnoDB, 0 queries in queue
32 read views open inside InnoDB
Main thread process no. 26262, id 140737005225728, state: sleeping
Number of rows inserted 241481, updated 282976, deleted 141484, read 59003586
5203.96 inserts/s, 10409.72 updates/s, 5204.16 deletes/s, 2170643.47 reads/s
1 row in set (0.00 sec)

mysql> 
mysql> set global innodb_thread_concurrency=1;
Query OK, 0 rows affected (0.00 sec)

mysql> show engine innodb status\G
ROW OPERATIONS
--------------
0 queries inside InnoDB, 31 queries in queue
32 read views open inside InnoDB
Main thread process no. 26262, id 140737005225728, state: sleeping
Number of rows inserted 297282, updated 394570, deleted 197283, read 82270739
3985.50 inserts/s, 7970.43 updates/s, 3985.36 deletes/s, 1661819.44 reads/s
1 row in set (0.00 sec)

mysql> set global innodb_thread_concurrency=0;
Query OK, 0 rows affected (0.00 sec)

mysql> show engine innodb status\G
ROW OPERATIONS
--------------
0 queries inside InnoDB, 29 queries in queue
31 read views open inside InnoDB
Main thread process no. 26262, id 140737005225728, state: sleeping
Number of rows inserted 300521, updated 401050, deleted 200522, read 83620975
202.42 inserts/s, 404.97 updates/s, 202.42 deletes/s, 84384.48 reads/s
1 row in set (0.01 sec)

mysql>
[8 Oct 2015 7:08] MySQL Verification Team
Hello Nilnandan Joshi,

Thank you for the report.
Observed this with 5.6.27 release build.

Thanks,
Umesh