Seems go.plugin mysql collector connect & disconnect every collect

Environment

Server: Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-73-generic x86_64)
Netdata: v1.30.1
MySQL: 8.0.18 - Source distribution

Problem/Question

It seems like that go.plugin mysql collector “get a connection - collect info - release the connection” in every collect cycle. I found out that in SHOW PROCESSLIST, user netdata (which I assigned to netdata) has always 0 in time column. IDK why, if this way has better performance?

Hi @AnnAngela

No, we don’t release the connection on every data collection cycle. We create/open the connection during the first data collection and keep using it.

I see we set SetConnMaxLifetime to 1 minute, so i would expect release/recreate every 1 minute.

When you do show processlist; pay attention to the Host field - if it changes it means there is a new connection (e.g.: 172.17.0.1:46860 => 172.17.0.1:46868).

I don’t remember why we set it to 1 minute :thinking: Can increase it to 5.

yep, I worte a script to verify that, still dont know why mysql keeps saying the connection duration is 0.
But from my personal experience, keeping one single connection is better than creating & releasing connection repeatly in this situation (maybe I’m wrong, if so please correct me)

It sounds logical, i will read on the subject. I’ve increased the timeout to 10 minutes.