Will tarantool helps in OpenVZ? - mysql

I have a small OpenVZ container.
2 cores and 4096MB RAM.
I have mysql database (overal size is 80MB InnoDb)
When i do 100 queries like INSERT ON DUPLICATE KEY UPDATE, few of them executes longer than 1 seconds, always
mysql> SHOW PROFILE;
+----------------------+----------+
| Status | Duration |
+----------------------+----------+
| checking permissions | 0.000040 |
| creating table | 0.000056 |
| After create | 0.011363 |
| query end | 1.231525 |
| freeing items | 0.000089 |
| logging slow query | 0.000019 |
| cleaning up | 0.000005 |
+----------------------+----------+
7 rows in set (0.00 sec)
When i turned off binary logging, it helped. So the problem maybe in hard drive. And occurs when binary log is writing during the query executing.
Will it help, if i replace mysql with the tarantool? As i know tarantool also writes binlogs.
I have percona mysql
mysql> select version();
+-----------------+
| version() |
+-----------------+
| 5.6.25-73.1-log |
+-----------------+
1 row in set (0.01 sec)
Here is the my.cnf
[client]
default-character-set = utf8mb4
[mysql]
# CLIENT #
port = 3306
socket = /var/lib/mysql/mysql.sock
default-character-set = utf8mb4
[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
# GENERAL #
user = mysql
default-storage-engine = InnoDB
socket = /var/lib/mysql/mysql.sock
pid-file = /var/lib/mysql/mysql.pid
# MyISAM #
key-buffer-size = 32M
myisam-recover = FORCE,BACKUP
# SAFETY #
max-allowed-packet = 16M
max-connect-errors = 1000000
# DATA STORAGE #
datadir = /var/lib/mysql/
# BINARY LOGGING #
#log-bin = /var/lib/mysql/mysql-bin
#expire-logs-days = 14
#sync-binlog = 1
# CACHES AND LIMITS #
tmp-table-size = 128M
max-heap-table-size = 128M
query-cache-type = 1
query-cache-size = 32M
max-connections = 1000
thread-cache-size = 128
open-files-limit = 65535
table-definition-cache = 1024
table-open-cache = 2048
# INNODB #
innodb-flush-method = O_DIRECT
innodb-log-files-in-group = 2
innodb-log-file-size = 256M
innodb_log_buffer_size = 32M
innodb-flush-log-at-trx-commit = 0
innodb-file-per-table = 1
innodb-buffer-pool-size = 1G
innodb_buffer_pool_instances = 1
# LOGGING #
log-error = /var/lib/mysql/mysql-error1.log
log-queries-not-using-indexes = 1
slow-query-log = 1
slow-query-log-file = /var/lib/mysql/mysql-slow.log
long_query_time = 1
log-queries-not-using-indexes = 1
#PERCONA
log_slow_verbosity = microtime,query_plan,innodb

Yes Tarantool write 'binlogs' (WAL - write-ahead logging).
Definitely tarantool are more faster than mysql.
But probably mysql need more tuning. Sorry I'm not know much about mysql tuning.

Tarantool should help you out here.
It delivers sub 0.001s latencies even with transaction log turned on. Here is the piece of code that helps you testing Tarantool under heavy read/write workloads: https://gist.github.com/danikin/a5ddc6fe0cedc6257853.

Related

MySQL Master-Master replication issue

I have MySQL 5.7 installed on two servers and I configured both servers' mysqld.cnf file as shown below
Server1 configuration.
[mysqld]
bind-address = 192.168.0.1
server_id = 1
log_bin = /var/log/mysql/mysql-bin.log
log_bin_index = /var/log/mysql/mysql-bin.log.index
relay_log = /var/log/mysql/mysql-relay-bin
relay_log_index = /var/log/mysql/mysql-relay-bin.index
expire_logs_days = 10
max_binlog_size = 100M
log_slave_updates = 1
auto-increment-increment = 2
auto-increment-offset = 1
Server2 configuration.
[mysqld]
bind-address = 192.168.0.2
server_id = 2
log_bin = /var/log/mysql/mysql-bin.log
log_bin_index = /var/log/mysql/mysql-bin.log.index
relay_log = /var/log/mysql/mysql-relay-bin
relay_log_index = /var/log/mysql/mysql-relay-bin.index
expire_logs_days = 10
max_binlog_size = 100M
log_slave_updates = 1
auto-increment-increment = 2
auto-increment-offset = 2
Then when I get the out put from Server1 with the below:
mysql> SHOW MASTER STATUS;
+------------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000006 | 459 | | | |
+------------------+----------+--------------+------------------+-------------------+
Then I go to run and get the output as per below at Server2:
mysql> STOP SLAVE;
mysql> CHANGE MASTER TO master_host='192.168.0.1', master_port=3306,
master_user='replicauser',
master_password='somestrongpassword', master_log_file='mysql-bin.000006',
master_log_pos=459;
mysql> START SLAVE;
mysql> SHOW MASTER STATUS;
+------------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000007 | 154 | | | |
+------------------+----------+--------------+------------------+-------------------+
So what is the missing to complete my solution ?
Edit:
The missing part was just restart for both servers

About the user filtering of mysql percona audit plugin

I have a mysql server. I use Percona and I use the audit log plugin. I have no problem with this.
But there are too many active users in the sub-structure using mysql. I just want to keep the audit logs of real users. I want to use the include and exclude properties for this.
When I apply the following percona article, it fails because it cannot find the mysql variable. Does not add new variable.
Any advice on this?
https://www.percona.com/doc/percona-server/LATEST/management/audit_log_plugin.html#filtering-by-user
I have added the following line to my.cnf file, but again nothing has changed.
audit_log_include_accounts = 'test # localhost'
[root#mysql-server ~]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
[root#mysql-server ~]# yum list installed |grep "percona"
Percona-Server-client-57.x86_64 5.7.22-22.1.el7 #percona
Percona-Server-server-57.x86_64 5.7.11-4.1.el7 #percona
Percona-Server-shared-57.x86_64 5.7.22-22.1.el7 #percona
Percona-Server-shared-compat-57.x86_64 5.7.22-22.1.el7 #percona
percona-toolkit.x86_64 3.0.10-1.el7 #percona
[root#mysql-server ~]# mysql -V
mysql Ver 14.14 Distrib 5.7.22-22, for Linux (x86_64) using 6.2
mysql> SHOW VARIABLES LIKE 'audit%';
+---------------------------+--------------------------+
| Variable_name | Value |
+---------------------------+--------------------------+
| audit_log_buffer_size | 1048576 |
| audit_log_file | /var/log/mysql/audit.log |
| audit_log_flush | OFF |
| audit_log_format | JSON |
| audit_log_handler | FILE |
| audit_log_policy | ALL |
| audit_log_rotate_on_size | 10485760 |
| audit_log_rotations | 10 |
| audit_log_strategy | ASYNCHRONOUS |
| audit_log_syslog_facility | LOG_USER |
| audit_log_syslog_ident | percona-audit |
| audit_log_syslog_priority | LOG_INFO |
+---------------------------+--------------------------+
12 rows in set (0.01 sec)
mysql> SET GLOBAL audit_log_include_accounts = 'test#localhost';
ERROR 1193 (HY000): Unknown system variable 'audit_log_include_accounts'
mysql>
mysql> SET GLOBAL audit_log_include_accounts = NULL;
ERROR 1193 (HY000): Unknown system variable 'audit_log_include_accounts'
[root#mysql-server ~]# cat /etc/my.cnf
[client]
port = 3306
socket = /var/lib/mysql/mysql.sock
[isamchk]
key_buffer_size = 16M
[mysqld]
audit_log_file = /var/log/mysql/audit.log
audit_log_format = JSON
audit_log_policy = ALL
audit_log_rotate_on_size = 10M
audit_log_rotations = 10
basedir = /usr
bind-address = 0.0.0.0
binlog-format = ROW
datadir = /var/lib/mysql
default-storage-engine = innodb
expire_logs_days = 7
explicit_defaults_for_timestamp = 1
innodb-buffer-pool-size = 1G
innodb-file-per-table = 1
innodb-flush-log-at-trx-commit = 2
innodb-flush-method = O_DIRECT
innodb-log-file-size = 512M
innodb-log-files-in-group = 2
key_buffer_size = 16M
log-error = /var/log/mysql/mysqld.log
log-queries-not-using-indexes = 0
max-connect-errors = 1000000
max-connections = 1000
max-heap-table-size = 512M
max_allowed_packet = 16M
max_binlog_size = 100M
open-files-limit = 65535
pid-file = /var/run/mysqld/mysqld.pid
port = 3306
query-cache-type = 1
query_cache_limit = 12M
query_cache_size = 16M
server_id = 1
skip-external-locking
skip-name-resolve
slave-skip-errors = 1062,1053
slow-query-log = 1
slow-query-log-file = /var/log/mysql/mysql-slow.log
socket = /var/lib/mysql/mysql.sock
ssl = false
ssl-ca = /etc/mysql/cacert.pem
ssl-cert = /etc/mysql/server-cert.pem
ssl-key = /etc/mysql/server-key.pem
sync-binlog = 0
sysdate-is-now = 1
table-definition-cache = 4096
table-open-cache = 4096
thread_cache_size = 8
thread_stack = 256K
tmp_table_size = 16M
tmpdir = /tmp
user = mysql
[mysqld-5.0]
myisam-recover = BACKUP
[mysqld-5.1]
myisam-recover = BACKUP
[mysqld-5.5]
myisam-recover = BACKUP
[mysqld-5.6]
myisam-recover-options = BACKUP
[mysqld-5.7]
myisam-recover-options = BACKUP
[mysqld_safe]
log-error = /var/log/mysql/mysqld_safe.log
nice = 0
socket = /var/lib/mysql/mysql.sock
[mysqldump]
max_allowed_packet = 16M
quick
quote-names
!includedir /etc/my.cnf.d
I found the cause of the problem. The version needs to be upgraded. When I upgraded the version, the variables came automatically and I can make changes.
However, the supported version is 5.7 in the documentation. But not exactly.
my current version: '5.7.11-4.1.el7'
The version I upgraded to: '5.7.24-27.1.el7'

Ubuntu | Mysql Server 300-750% CPU

I have already tried so many things, and now I am slowly converting the despair.
To my problem, I have already done a lot of adjustments to the MySQL Configuration,
but unfortunately I always get back to time utilization very high CPU.
Multiple MySQL processes partially between 200-750% CPU / Ram usage is ok about 50%.
Information on the system:
Root: HP ProLiant DL120 1Gbps / Intel Quad-Core Xeon X3440 - 16GB Ram / Ubuntu Server operating system
There are 3 databases (3 sites), each with 16 tables | DB_1 = 35MB - 560MB DB_2 = - = DB_3 3,4GB
Websites are optimized (database queries / cache, etc.) | visitors per day about 15K / day per page
At the root runs only Nginx + PHP5-FPM and mySQL, and all 8 processors are completely overloaded.
MySQLTuner edition:
>> MySQLTuner 1.1.1 - Major Hayden <major#mhtx.net>
>> Bug reports, feature requests, and downloads at http://mysqltuner.com/
>> Run with '--help' for additional options and output filtering
-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.5.44-0ubuntu0.14.04.1
[OK] Operating on 64-bit architecture
-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 65K (Tables: 2)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[--] Data in InnoDB tables: 3G (Tables: 44)
[!!] Total fragmented tables: 18
-------- Security Recommendations -------------------------------------------
[OK] All database users have passwords assigned
-------- Performance Metrics -------------------------------------------------
[--] Up for: 4s (991 q [247.750 qps], 73 conn, TX: 8M, RX: 91K)
[--] Reads / Writes: 99% / 1%
[--] Total buffers: 12.5G global + 3.6M per thread (100 max threads)
[OK] Maximum possible memory usage: 12.8G (81% of installed RAM)
[OK] Slow queries: 0% (8/991)
[OK] Highest usage of available connections: 28% (28/100)
[OK] Key buffer size / total MyISAM indexes: 256.0M/120.0K
[!!] Query cache efficiency: 17.8% (155 cached / 873 selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 26 sorts)
[OK] Temporary tables created on disk: 20% (61 on disk / 302 total)
[OK] Thread cache hit rate: 61% (28 created / 73 connections)
[OK] Table cache hit rate: 95% (138 open / 145 opened)
[OK] Open file limit used: 5% (52/1K)
[OK] Table locks acquired immediately: 100% (712 immediate / 712 locks)
[OK] InnoDB data size / buffer pool: 3.4G/7.8G
-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
MySQL started within last 24 hours - recommendations may be inaccurate
Enable the slow query log to troubleshoot bad queries
MySQL Configuration I have so often changed, can not think of the current "my.cnf":
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
bind-address = 127.0.0.1
# Tunning #
tmp_table_size = 4000M
max_heap_table_size = 4200M
max_connections = 100
max_allowed_packet = 16M
thread_cache_size = 32M
query_cache_size = 512M
query_cache_min_res_unit = 4K
sort_buffer_size = 2M
join_buffer_size = 128K
preload_buffer_size = 32K
key_buffer_size = 256M
read_buffer_size = 1M
read_rnd_buffer_size = 256K
low_priority_updates = 1
concurrent_insert = ALWAYS
# INNODB #
innodb_log_files_in_group = 2
innodb_log_file_size = 256M
innodb_file_per_table = 1
innodb_buffer_pool_instances = 8
innodb_buffer_pool_size = 8000M
innodb_read_io_threads = 16
innodb_write_io_threads = 16
innodb_thread_concurrency = 0
# Logging
log_warnings = 2
log_error = /var/log/mysql/error.log
slow_query_log = 1
slow_query_log_file = /var/log/mysql/mysql-slow.log
long_query_time = 1
log_queries_not_using_indexes = 1
min_examined_row_limit = 20
# Binary Log / Replication
server_id = 1
binlog_cache_size = 1M
sync_binlog = 8
binlog_format = row
expire_logs_days = 7
max_binlog_size = 128M
relay-log = /var/log/mysql/slave-relay.log
relay-log-index = /var/log/mysql/slave-relay-log.index
[mysqldump]
quick
single-transaction
max_allowed_packet = 8M
[mysql]
no_auto_rehash
[myisamchk]
key_buffer = 265M
read_buffer = 8M
write_buffer = 8M
[mysqld_safe]
open-files-limit = 8192
log-error = /var/log/mysql/error.log
!includedir /etc/mysql/conf.d/
key_buffer = 8M
max_allowed_packet = 8M
thread_stack = 192K
thread_cache_size = 4
[mysqldump]
quick
quote-names
max_allowed_packet = 8M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
[isamchk]
key_buffer = 8M
!includedir /etc/mysql/conf.d/
PROCESSLIST Output:
mysql> SHOW PROCESSLIST;
+-------+---------+-----------+-------------+---------+------+----------------------+------------------------------------------------------------------------------------------------------+
| Id | User | Host | db | Command | Time | State | Info |
+-------+---------+-----------+-------------+---------+------+----------------------+------------------------------------------------------------------------------------------------------+
| 251 | pb_root | localhost | db_name | Sleep | 1 | | NULL |
| 48726 | root | localhost | NULL | Query | 0 | NULL | SHOW PROCESSLIST |
| 48775 | pb_root | localhost | db_name | Sleep | 0 | | NULL |
| 48838 | ww_root | localhost | db_name | Query | 1 | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts |
| 48845 | ww_root | localhost | db_name | Query | 0 | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts |
| 48846 | ww_root | localhost | db_name | Query | 0 | preparing | SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND (wp_posts.ID NOT IN ( |
| 48847 | ww_root | localhost | db_name | Sleep | 0 | | NULL |
| 48854 | pb_root | localhost | db_name | Sleep | 1 | | NULL |
| 48735 | pb_root | localhost | db_name | Sleep | 0 | | NULL |
| 48878 | ww_root | localhost | db_name | Query | 1 | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts |
| 48845 | pb_root | localhost | db_name | Query | 0 | Copying to tmp table | SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts |
| 48827 | ww_root | localhost | db_name | Sleep | 0 | | NULL |
+-------+---------+-----------+-------------+---------+------+----------------------+------------------------------------------------------------------------------------------------------+
I try my problems actually getting yourself to solve somehow, but unfortunately I'm really at a loss now.
Please check below remarks, if it helps you-
tmp_table_size = 4000M #reduce it to 256M even should be lower but set at this time. Also there should be space in /tmp partiont at least equal or greate to this variable.
max_heap_table_size = 4200M #should be same as tmp_table_size so set it 256M
max_connections = 100
max_allowed_packet = 16M
thread_cache_size = 32M #It should be in numbers set it to 50 for re-use.
query_cache_size = 512M #as your mysql tuner report is showing very less use of query_cache so you can disable it or reduce to 20M
query_cache_limit = 2M #add it if use above query_cache_size variable else no need.
query_cache_min_res_unit = 4K #can comment it.
sort_buffer_size = 2M
join_buffer_size = 128K
preload_buffer_size = 32K #can comment it for testing.
key_buffer_size = 256M #keep it 50M if not using myisam tables and your server is innodb.
read_buffer_size = 1M
read_rnd_buffer_size = 256K
low_priority_updates = 1 #comment it for testing purpose further you can on as per your requirement.
concurrent_insert = ALWAYS
# INNODB #
innodb_log_files_in_group = 2
innodb_log_file_size = 256M #this can create increase mysql restart time, for mysql 5.5 it is default 5M so you can set as per requirement but 256M is seems too high means you are allocating 500M to log file.
innodb_file_per_table = 1
innodb_buffer_pool_instances = 8
innodb_buffer_pool_size = 8000M
innodb_read_io_threads = 16
innodb_write_io_threads = 16
innodb_thread_concurrency = 0
# Binary Log / Replication
binlog_cache_size = 1M #comment it and keep default as it uses server resources per connection if not set it high due to any specific reason.
Except this so many sections are duplicate in your config file like mysqld_safe and mysqldump.
Also mysqltuner report is showing that 20% temp table is creating on disk means queries are not optmized or not using index.
Need to check slow queries and optimize them.
As per my experience SQL_CALC_FOUND_ROWS kill the performance, so you should use count intead of this.

what should be the my.cnf file's configuration when working with the huge amount of catalog in magento?

I am working on **magento version 1.9.1.0 and i have a huge amount of catalog.This is working on AWS(m3large server) with 2 virtual cpu's and 7.5 GB memory.After reindexing all attributes Home page is not visible and its showing no data received error.Taking too much time to response in other pages too.
Database table sizes is below and my.cnf file's configuration.
how to decrease response time and resolve home page visibility issue.
**datbase table sizes in MB
1.catalogsearch_fulltext | 8526.87 |
2.catalog_product_entity_varchar| 2734.56 |
3.catalog_product_entity_text | 1849.33 |
4.core_url_rewrite | 1806.23 |
5.catalog_category_product_index | 1536.00 |
6.catalog_product_index_price | 1167.97 |
7.catalog_product_index_eav_idx | 1097.34 |
8.catalog_product_index_price_idx | 1012.20 |
9.catalog_product_index_price_final_idx | 987.00 |
10.catalog_product_flat_1 | 826.84 |
11.catalog_product_index_eav | 766.69 |
12.catalog_product_entity_int | 765.45 |
13.catalog_category_product_index_idx | 758.92 |
14.catalog_product_entity_decimal | 689.39 |
15.catalog_category_product_index_enbl_idx | 472.77 |
16.catalog_category_anc_products_index_idx | 418.70 |
17.cataloginventory_stock_item | 311.42 |
18.catalog_product_entity | 295.53 |
19.cataloginventory_stock_status_idx | 158.75 |
20.cataloginventory_stock_status | 158.75 |
21.catalog_product_entity_media_gallery | 117.30 |
22.catalog_category_product | 97.17 |
23.catalog_product_website | 87.16 |
24.catalog_product_entity_media_gallery_value | 35.08 |
25.product_stock | 27.56 |
26.catalogsearch_result | 22.55 |
27.log_visitor_info | 13.52 |
28.log_url_info | 8.52 |
29.log_url | 7.55 |
30.report_event | 7.08 |
31.catalog_category_entity_varchar | 6.06 |
32.log_visitor | 5.52 |
33.core_email_template | 3.56 |
**my.cnf** file's configuration
*# The MySQL database server configuration file.
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
**# The following values assume you have at least 32M ram
**# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 0.0.0.0
#
# * Fine Tuning
#
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover = BACKUP
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Here you can see queries with especially long duration
#log_slow_queries = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
#server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
innodb_lock_wait_timeout = 5000
innodb_buffer_pool_size = 2048M
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
slow-query-log = 1
slow-query-log-file = /var/log/mysql/mysql-slow.log
long_query_time = 1
log-queries-not-using-indexes
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
[isamchk]
key_buffer = 16M
#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/

mysql thread not executing. Still in sleep state

I was running benchmark test in mysql server using mysqlslap. But sometimes the last thread in the pool is not executing and closing the connection. It keeps in sleep state.
mysql> show full processlist;
+-----+------+-----------------------+-----------+---------+------+-------+-----------------------+
| Id | User | Host | db | Command | Time | State | Info |
+-----+------+-----------------------+-----------+---------+------+-------+-----------------------+
| 2 | root | 122.178.231.xxx:15832 | mysqlslap | Sleep | 740 | | NULL |
| 106 | root | localhost | NULL | Query | 0 | NULL | show full processlist |
+-----+------+-----------------------+-----------+---------+------+-------+-----------------------+
2 rows in set (0.00 sec)
Any idea? It happens often :(
This was the command I executed.
mysqlslap -h IP_address -u root --auto-generate-sql --concurrency=100
-pPASSWORD -vvv --number-of-queries=2500
my.cnf file is as follows,
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
skip-bdb
max_connections = 500
query_cache_type = 1
query_cache_size = 128M
sort_buffer_size = 64M
key_buffer_size = 425M
query_cache_limit = 1024M
thread_cache_size = 4M
innodb_buffer_pool_size = 1360M
innodb_log_file_size = 512M
long_query_time = 5
innodb_thread_concurrency = 8
innodb_lock_wait_timeout = 300
max_allowed_packet = 128M
net_read_timeout = 240
net_write_timeout = 240
table_lock_wait_timeout =240
connect_timeout = 30
log-warnings = 2
log = /var/log/mysqld.log
log-error = /var/log/mysqld.error.log
log-slow-queries = /var/log/mysql_slow_queries.log