I have a setup of 2 HAProxy servers using the KeepAlived process for failover, and each HAProxy is configured to load balance mysql connections to my MariaDB Galera cluster of 3 nodes. I'm trying to load test my environment, and before I even push traffic to one of my nodes, i'm looking at the netstat -an | grep 3306, and this is what I see on my first node:
ubuntu@mariadb1:~$ netstat -an |grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
tcp 0 0 10.60.61.21:3306 10.60.61.19:44563 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.19:44521 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.19:44536 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.20:58622 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.20:58637 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.20:58649 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.19:44533 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.19:44557 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.20:58616 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.20:58628 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.20:58619 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.20:58646 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.20:58625 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.20:58631 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.19:44551 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.20:58652 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.19:44524 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.20:58658 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.19:44545 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.20:58655 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.20:58640 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.20:58634 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.19:44539 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.19:44554 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.19:44527 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.20:58661 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.19:44518 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.19:44548 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.19:44560 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.19:44530 TIME_WAIT
tcp 0 0 10.60.61.21:3306 10.60.61.20:58643 TIME_WAIT
I want to know why the HAProxy's are filling up the connections on 3306 before I have even generated any traffic. I would have thought that the primary HAProxy would have to have at least one connection running so that it could pass traffic, but not both HAProxy's simultaneously, and not with this many concurrent connections. Please let me know what I need to look for to tune this, or just accept that this is normal behavior for a HA setup.
Here are the spec's on my mariaDB machines:
Ubuntu 12.04 8GB RAM 4 vCPU (each node is running in VMware)
If you need the /etc/mysql/my.cnf file please let me know, or the /etc/haproxy/haproxy.cnf file. Sorry if my post seems terribly formatted, not sure how to make this look all nice and clean like the rest of you guys.