Skip to content

Too many connections problem in MySQL surfaced as high load on ec2 machine

April 20, 2015

After the deployment of the new services in Go, to our production servers, started to see load of 40, 60 on one of the machine.

On investigating logs showed problems with DB connection handling.

Logged in to mysql(root)

1) show processlist;
(It showed, 100+ rows. On two other machines it was around in 30s)

2) MySql listens on port 3306. To find out processes holding connection to MySql do:
netstat -ntp | grep :3306 | wc -l

3) So reduced the per process (for both Java and Go services) max DB connections to 25 from 50.

4) Increased back the route_search etc. things to 50.

5) Also increased the max connections to 1000 in /etc/my.cnf

This seems to help, but lets see.

The blog below was a great help in finding out, the guilty processes using netstat/etc:
http://www.percona.com/blog/2007/02/08/debugging-sleeping-connections-with-mysql/

Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: