Grafana MySQL Adapter Connection Queries

Hi There

We are using MySQL as our data source for Grafana dashboards. This is working fine except the following problem that we are experiencing.

Over a period of usage we start getting “Too Many Connections” errors on MySQL. While we are working to increase the number of allowed connections I did have the following questions wrt to the Grafana and MySQL Data source plugin.

  1. If I have two dashboard users concurrently logged into Grafana and each viewing 2 reports each, then what is the expected number of connections to MySQL, is it, one “per report per user” or something else.

  2. When does Grafana open a SQL connection and when does it close it - what is the logic.

  3. For Auto refreshing reports (Example: Last 5 minute data) does Grafana open a SQL connection for every refresh cycle or is there a different logic.

  4. Is it possible to configure/tweak the connection timeout values?

  5. What about connection pooling - is it possible to configure connection pooling for MySQL?
    MySQL :: MySQL Connector/J 5.1 Developer Guide :: 7 Connection Pooling with Connector/J

Regards
Deepak

Hi,

In general one connection per user. But depending on connection pooling implementation I would expect that connections should be reused etc.

Basically each beginning/end of each request. But there could be several opened/closed during one request depending on what kind of operation we’re talking about.

Yes

See max_idle_conn, max_open_conn and conn_max_lifetime configuration parameters.

Marcus

1 Like