Score:0

Why do I have 5/4 active MySQL connections at all times?

bd flag

Ive created a MySQL 5.7 instance on google SQL and from the very first day, for no apparent reason, I've had 4/5 active connections at all time.

Those connections are definitely not me and, from what I understand, I am having to pay for that usage even thought it wasn't me using the SQL instance. I do have daily backups set up but they happen once a day and don't see why backup mechanism that Google provides would be connected to MySQL instance at all times.

What can be done about it or is it just part of it?

view of what I see within my control panel


Diagnostics.

I've run commands below using MySQLWorkbench.

SHOW PROCESSLIST; (I've hid two entries with my IP address)

SHOW GLOBAL STATUS LIKE 'Threads_running';

SHOW GLOBAL STATUS LIKE 'Max_used_connections';

ua flag
Let's see `SHOW PROCESSLIST;`
Score:0
bd flag

After some digging I found a describe command that states all the settings about an instance: gcloud sql instances describe {instanceName}. Here, under settings, I saw that my activation policy is set to always activationPolicy: ALWAYS, which means that my instance is always running.

From what I understood, after some further reading, is that google keeps instance alive and those active connection are tied to this.

On demand usage is not something that google has on offer - https://issuetracker.google.com/issues/69109113#comment77

Score:0
ua flag

To help diagnose the situation, please run these:

SHOW PROCESSLIST;  -- Will show processes (including background threads)
SHOW GLOBAL STATUS LIKE 'Threads_running';  -- num procs actually running
SHOW GLOBAL STATUS LIKE 'Max_used_connections';   -- highwater mark

(I do not know which of the above maps to "Active connections"; I need to back up to what MySQL thinks in order to help.)

(It may be that Google has added code to MySQL; can't help you there.)

In any case, the mystery-5 is probably not too important.

More

Those screen shots do not show any activity.

"Sleep" connections cause very little overhead; don't worry about them. Watch (by doing SHOW PROCESSLIST repeatedly) the "Time" for them; you may find that they increase to, say, 30 and then reset to 0. That would mean that they are doing something every 30 seconds. And, since you probably missed what they did, it is something quite fast. I would guess some monitoring query -- which is beneficial to you.

bd flag
I've posted screenshots to the main post, thank you.
bd flag
after further reading it seems like google just keeps some connections open for its own use.
bd flag
I was hoping for google sql to work on demand to save some money, but it doesn't seem to work that way :(
ua flag
@user3402600 - I added more.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.