6

Excessive number of open connections between Web server and DB

 3 years ago
source link: https://www.codesd.com/item/excessive-number-of-open-connections-between-web-server-and-db.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Excessive number of open connections between Web server and DB

advertisements

I run 2 servers, 1 web (nginx/php), 1 database (mysql).

Nginx has about 1500 active processes per second, and mysql status shows about 15 currently option connections on average.

Now today i started running: netstat -npt | awk '{print $5}' | grep -v "ffff\|127\.0\.0\.1" | awk -F ':' '{print $1}' | sort -n | uniq -c | sort -n

This showed that there were over 7000 active connections from my webserver to my database server IP. This seems kind of extreme. I do not use persistent connections in PHP to connect to Mysql.

I tried using mysql_close() also, but that seems to make no difference.

On the webserver netstat shows over 7000 connections to the database server

On the database server netstat shows just 300 connections to the web server

Any idea why there are so many open connections?


Try checking for established connections only:

netstat -npt | grep ESTABLISHED | awk ...


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK