Question

Website took too long to respond (Temporal - After comes back to normal)

Posted April 10, 2020 1.9k views
Nginx

Hi. I have a VPS here. From time to time, all the websites hosted on the VPS don’t go through (“took too long to respond.”) by TIMEOUT. Then after some time it will again go through. but when i check the metrics, i don’t see any high utilization of CPU, Bandwidth or even disk I/O. what could possibly cause this temporal issue. But i can SSH into the server very well

Actually i host on an NGINX server that hosts subdomains on 2 domains. one runs on a docker container and i proxy it through the main NGINX while the other works directly under wordpress with the main NGINX server. I also have a phpmyadmin subdomain and all go down! I’m so confused

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
2 answers

SSH to the server

sudo apt(yum) install htop

then once installed just run

htop

This will show what processes are running and which are using more resources.

You would also tail logs.

cd /var/log
sudo tail -f syslog
sudo tail -f nginx/access.log
sudo tail -f php.XX.log

while tailing logs, browse your sites until you see traffic show in the logs, and experience the slow downs

  • thanks @sheldon, i’m indeed grateful for you reply. it seems the RAM usage is very high and it got into the swap as well. Just that i don’t see any button to send you a screenshot here. i might just have to increase the capacity of the server. but why doesn’t it show on the digital ocean dashboard

  • But when I try to tail the logs and browse the site, no request seems to arrive at the server. could it still be as a result of the high RAM usage? Cause I don’t have any firewall that could be blocking. and moreover, after some time, the server regains its active state

    • Check your NGINX config and make sure you having loggin enabled and that are logging to the same path /var/log/nginx/{access|error}.log path.

Hi there @tclarencek,

As you are able to SSH to the Droplet, it sounds like your Nginx service is experiencing some issues.

What I could suggest here is, the next time you notice the problem, SSH to your Droplet and do the following:

  • Check your Nginx error logs, you can do that with the following command:
  • tail -100 /var/log/ngnix/error.log

You can also use this script here to summarize your access log.

  • Check your Nginx access logs for any suspicious activity:
  • tail -100 /var/log/nginx/error.log
  • Check your Docker status:
  • sudo systemctl status docker

Feel free to share any of the logs here so I could try to further advise.

Regards,
Bobby

  • Thanks for the reply @bobbyiliev. I have the impression from @Sheldon’s response that the ram usage was high. Because all the logs seem okay. Thanks a lot for your aid !!!

  • But when I try to tail the logs and browse the site, no request seems to arrive at the server. could it still be as a result of the high RAM usage? Cause I don’t have any firewall that could be blocking. and moreover, after some time, the server regains its active state

Submit an Answer