Question

I have the following server on hostgator.com

Intel Xeon E3-1265L 2.5GHz
100 mbps Uplink
4 GB DDR3 Memory
500 GB RAID-1 Drives
10 TB Bandwidth
Up to 5 Dedicated IPs

In the past 2 months we have received many times the too many connections error. We have less than 1000 visits per day so I don't think that's too much for the server.

Last week, it happened again and what we did with the support team was to clear the magento log tables. I also reduced the magento log retention from 180 days to 5 days only.

Today it happened again, whm, cpanel or the domain itself its completely inaccessible.

I wonder if this is due to search engines crawling our website or not? Last week I reduced in google webmaster tools the speed of the crawl.

Today at the same time we had the mysql connection problem, we also had multiple Hangs on spamd service and chkservd.

The question is:

If I increase max connections to 400, is that too much for my server?

Do you think I need more server processor or ram?
Or do you think it might be a denial of service attack?

Please Help.

Thanks in advance.

Update

top - 05:41:25 up 12 days, 17:57, 1 user, load average: 33.40, 38.14, 54.62 
Tasks: 267 total, 12 running, 247 sleeping, 4 stopped, 4 zombie 
Cpu(s): 11.1%us, 0.9%sy, 0.1%ni, 83.7%id, 3.9%wa, 0.1%hi, 0.1%si, 0.0%st 
Mem: 2917444k total, 2281856k used, 635588k free, 56324k buffers 
Swap: 4194296k total, 290924k used, 3903372k free, 343860k cached 

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 
26327 theprint 16 0 57088 42m 6640 R 94.0 1.5 0:58.97 php 
26316 theprint 16 0 58592 44m 6640 R 86.2 1.6 1:04.44 php 
26308 theprint 16 0 58592 44m 6644 R 74.4 1.5 1:05.23 php 
26383 theprint 16 0 59500 45m 6640 R 74.4 1.6 0:56.33 php 
26278 theprint 16 0 58596 44m 6640 R 72.5 1.5 1:05.95 php 
1253 theprint 16 0 54224 39m 6640 R 66.6 1.4 0:07.85 php 
26280 theprint 16 0 58336 44m 6640 R 64.6 1.5 1:00.90 php 
26653 theprint 16 0 59784 45m 6640 R 52.9 1.6 0:44.99 php 
26421 theprint 15 0 56280 41m 6640 S 29.4 1.5 0:36.84 php 
Was it helpful?

Solution

If I increase max connections to 400, is that too much for my server?

We don't know: you've provided no details of how your server is performaing nor what it's capacity might be. Even if you had, you'd be unlikely to get a sensible answer.

I wonder if this is due to search engines crawling our website or not?

Maybe, why don't you investigate it. Even if the toys provided for configuring your server aren't working, the data should be available from your logs.

Go read some good books on MySQL performance tuning (this is a good start) and on tuning the rest of your stack.

OTHER TIPS

You will need to study your server load handling capacity and how much concurrent connection it can handle at a time.

If there are too many MySQL connections and requests coming simultaneously then this situation occurs. Because sever unable to handle such bulk requests at a time. So in this case you can either increase the number of concurrent processes your server is handling to it's maximum value and the server capacity too.

But before proceeding, please make sure the concurrent requests are really genuine or not. You will need to monitor the continuous MySQL processes which are running. Your can check it by 'mysql -pr'. Once you will get the user which is consuming the maximum resources then go ahead and check why it's taking the resources. If you ill find there are not legitimate processes then you can suspend such users to avoid the generated issue.

If your website has Most Static pages?

Better use Cache

You lot of Options to lower you CPU usage

  • Mysql or mysqli cache
  • Running in PHP ? You can make a Simple caching script which can be modified to cache partial page or full page. Use Opcache like Zend that outperforms..
  • If you have Some more RAM? and the website is running in complete SQL? use Memcached.

I noticed that you are using cpanel? you need to tweak your Services Untick unwanted monitoring services and add cron to Clear old logs..

If you are getting Hits from a Bot or Referred from a Spam domain? block the referrer in htaccess.. or Use nginxcp for cpanel

Those are Guidance from my experience.. Hope this will work to Lower your CPU usage.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top