1

I've have a webserver that runs some services like Apache, Mysql, Redis and some NodeJS apps. On times of high traffic my server seems to do not support the heavy load. When it's ocurring, often when i try to access a page i receive the following message from mysql:

Warning: mysqli_connect(): (HY000/2003): Can't connect to MySQL server on '127.0.0.1' (99)

This message appears on a intermitent form, in a way that most of that time if i refresh the page this message do not appear again. Additionally, i don't think that is a problem on my configuration for mysql because i've the following result from mysqltuner.pl all the time:

[OK] Highest usage of available connections: 74% (336/450)

Similarly, Redis Server shows a message of problem to connect to the server:

Could not connect to Redis at 127.0.0.1:6379

I'm monitoring my server during those times and i figured out that aproximatly 2G of RAM (whitout making use of any byte of SWAP for the process of Mysql, Redis or NodeJS. After spend some time in research (without a North to follow), i read some about Ephemearal Ports. So i tried to adjust the net.ipv4.ip_local_port_range parameter to increase my port range (adjust from 32768 61000 to 10000 65000). The results were terrible! My webserver raises it's response time from a average of 180~200ms to aproximately 6000ms and the load average of the server raises a lot too (but the error messages disappear!).

My NodeJS apps (all of them) uses Socket.io and respond from a different por on my server. I'm trying to figure out what is the solution for the problem. Is that a port availability problem? Why is the net.ipv4.ip_local_port_range parameter adjust slowing down the server?

Server configuration:

  • Ubuntu Server x64
  • Intel Xeon E5520 Quad-Core
  • 8GB of RAM
  • 2x 1000 GB SATA 2,5" 5.400 rpm (RAID 1)
  • 2x 60 GB SSD 2,5" (RAID1) (Database stuff goes all here)
BigBlast
  • 111
  • 1

1 Answers1

1

If your question is on how to best monitor your server during high peak times, which is hard to do when it is peaking, I'd look for some light-weight tool to help with monitoring. Top, ps, and df don't always cut it.

I've used collectd to capture data points on my partitions, memory, cpu's, apache, mysql, and other things. It captures the data and saves those data points, then you'll need some other tool to retrieve the data - for example some web front ends to display the data.

Then to troubleshoot, perhaps a tool to hit your server and create a high-usage scenario. Apache Benchmark (ab) or Siege are good tools for this.

Vic
  • 231
  • 1
  • 3