I have a dedicated server that handles a lot of traffic, and I have been thinking it was too much on the server but my hosting company repeatedly tells me the server is fine. The only reason I assume it is unreachable for "everyone" and not just me is that fact that I use Google real time analytics and watch the numbers drop to single digits during the same time I can't connect. Usually the numbers are in the thousands.
It only lasts about 1-2 minutes each time but it happens 4-5 times per day and I am getting a lot of traffic so this is driving me crazy.
When I ping and tracert during the time I can't connect, it still give me responses. What is going on????
If you can successfully ping during a period when you can not process http or https request, this means the DNS and router is working and this is most likely a server issue.
Quick Check: Out of memory? Use SSH (secure shell) and log in with a
sudo
user account. This could beroot
but root may have been disabled for security purposes, so use an account that has full permissions. Once logged into server. Type the following (note: you should do this when you are not experiencing an outage to see how it compares to when an outage does occur):the results show how much memory is used. If the server is out of memory, the
top
command will display software running and amount of cpu and memory usage. UseQ
orControl + C
to exit the command. Solution, restart services as gracefully as possible and keep in mind you probably will need to add more RAM or resolve a software issue.If you have a linux dedicated server, check the
Apache log files
. You can do this because you have a dedicated server or VPS. Shared hosting accounts typically do not have this ability. To view the error logs, use SSH (secure shell) as a sudo and type:If using Ubuntu or Debian:
The
tail -100
stands for the last 100 records in the log. Insert your own value. If you would like to search for a particular term you could use:if using Ubuntu or Debian:
Here,
grep
is used for searching an expression,-i
makes the search case-insensitive, andinvalid
is the search term. More detail of apache logs.Reviewing the logs could reveal attempted server attacks, such as Denial of Service (DoS). You can research on Intrusion Detection Systems (IDS) or Intrusion Prevention System (IPS).
Your host company may not be looking in detail to your server. Ask them to review the logs as well for a second opinion.
You may have an issue with not enough system resources, such as RAM, to handle request at peek hours of usage. You can look into how many concurrent MySQL connections are occurring at times of outages. If your traffic numbers are in the thousands, your MySQL connections may be set too low. To view your max MySQL connections, you can use the following in a MySQL command line tool or something like phpMyAdmin:
This will return a max connections value: probably 100, with an average of 20 concurrent connections assumed. You can increase it by:
This command will immediately take effect, but will return to default upon a MySQL reboot. Change the value and see how the server handles your traffic. If you notice less outages, you can set the value permanently under
mysqld
in the file usually found under/etc/my.cnf
.Based on your information provided it is hard to say exactly what could be an issue. Your web application or site may not be properly closing open connections or has slow queries. You can look to enable MySQL Query Cache. This doesn't add much overhead but can help performance. Here are the documents on MySQL memory use. Enable your MySQL logs. There are several different log types for MySQL so enable the one pertaining to what you think is causing problems.
Hope this helps and comment with any questions.