[MDEV-20671] mysql slow connect on localhost Created: 2019-09-26 Updated: 2020-10-02 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Server |
| Affects Version/s: | 10.1.41 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Fayland Lam | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | performance | ||
| Environment: |
ubuntu 18.04 |
||
| Description |
|
background: it's 92G/20 CPU server with ubuntu 18.04 mysql Ver 15.1 Distrib 10.1.41-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2 issue:
it takes 20 seconds to connect mysql. IMPORTANT: it's not always like that, it happens when we have more visits. we use php-fpm and not PERSISTENT=true for PDO since that's localhost connection, it uses sockets (so that's not TCP or network issue). usually it takes 0.0X seconds. iostat: Linux 4.15.0-50-generic (fdb) 09/25/2019 x86_64 (20 CPU) avg-cpu: %user %nice %system %iowait %steal %idle Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn mysql conf: user = mysql bind-address = 0.0.0.0 key_buffer_size = 128M myisam_recover_options = BACKUP performance_schema = on innodb_buffer_pool_size=48G mysql status sorry it's too large so I made it in gist: https://gist.github.com/fayland/97050f70cb258a41f1fa1bd3046df4d2 it would be great that someone can point us the direction to check. if you need any more info, we'll be glad to provide. Thanks |
| Comments |
| Comment by Fayland Lam [ 2019-09-26 ] | ||||||||||||||||||||||||||||||||||
|
innodb_thread_concurrency is 0 it happens suddenly and after a while it's all good. we checked full processlist, no locks. and show status, connections are not full as well. how to debug that? Thanks | ||||||||||||||||||||||||||||||||||
| Comment by Fayland Lam [ 2019-09-26 ] | ||||||||||||||||||||||||||||||||||
|
it's not auth issue ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) real 0m8.228s if I do not type the password, it's still slow. | ||||||||||||||||||||||||||||||||||
| Comment by Fayland Lam [ 2019-09-26 ] | ||||||||||||||||||||||||||||||||||
|
flag -A does not help as well. so that's not rehashing as well
| ||||||||||||||||||||||||||||||||||
| Comment by Fayland Lam [ 2019-09-27 ] | ||||||||||||||||||||||||||||||||||
|
I get the server removed. please close it. thanks | ||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2019-10-06 ] | ||||||||||||||||||||||||||||||||||
|
Did you get the server removed because you had given up on dealing with it, or because you had found an environmental problem? If it's the latter, the information may be beneficial for the community. | ||||||||||||||||||||||||||||||||||
| Comment by Fayland Lam [ 2019-10-07 ] | ||||||||||||||||||||||||||||||||||
|
Hello. we changed the server (ubuntu 16.04 and mariadb 10.0.38) and it still happens. Thanks | ||||||||||||||||||||||||||||||||||
| Comment by Fayland Lam [ 2019-10-20 ] | ||||||||||||||||||||||||||||||||||
|
how to debug which part caused the slowness? I can duplicate the issue every day:
| ||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2020-10-02 ] | ||||||||||||||||||||||||||||||||||
|
Configuration suggestion
Increase your thread cache significantly - given 2900 are connection maybe 3000 is a good number. This will reduce the connection time by having a thread created in advance. On tracing: strace the server at the time of connection.
Had bit on the server strace is going to be filtering the right connection thread. Look for the connection. Tracing the client may see time delays at certain points in the protocol:
|