We have bought a package 4 CPU, 8 GB RAM & 160 GB SSD for a website cpdonline.in but it’s running very slow. Can you please help me why it’s running too slow, how can i optimize it?

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.

×
1 answer

Hello, @businessClam

What you can do is to monitor the droplet’s performance and see if there are any spikes in the CPU and memory usage. This will help you to determinate if the issue is related with the lack of server’s resources when your site is busy handling requests.

The thing is the issue might not be related with your website itself and you might experiencing the speed issues because your server is running low on memory. That is why it’s important to make sure that everything is operating normally.

You can also examine the logs for any killed processes as this will help you to see if the server is killing processes in order to remain stable. You can check this by looking at the /var/log/messages and search for kill, e.g

grep -i kill /var/log/messages

You can also check for out of memory (The OOM Killer) references in the log to see if the system is critically low on memory. This usually indicates that you need to upgrade if there are a lot of references.

grep -i oom /var/log/messages

You can exacute top or htop via ssh to see what process is taking the most CPU or memory. Both tools are really handy when it comes to monitor the server’s performance. I would like to mention that top comes installed by default and you might need to install htop.

For Ubuntu:

`sudo apt-get install htop

For Centos:

yum install htop

Top provides a simple, real-time table of your processes, with the largest consumers on top. Running htop, we can see that it has a similar output, but is colorized, and is more interactive:

There is a really useful tutorial you can check on how to use top, htop, netstat, du and other tools to Monitor Server Resources:

https://www.digitalocean.com/community/tutorials/how-to-use-top-netstat-du-other-tools-to-monitor-server-resources

You can also use sar to check what’s going on your droplet. With sar, you can monitor performance of various Linux subsystems (CPU, Memory, I/O..) in real time.

You can use it like this:

To check the memory usage (Free and Used ):

sar -r

To check the cpu usage:

sar -u

You can also check this tutorial for monitoring the CPU usage on your droplet:

https://www.digitalocean.com/community/tutorials/how-to-monitor-cpu-use-on-digitalocean-droplets

You can also track the performance with the Droplet Graphs which are available in your control panel. You can find more information here:

https://www.digitalocean.com/docs/droplets/how-to/graphs/

Hope this helps!

Regards,
Alex

by Justin Ellingwood
Monitoring a server's resources is an important task for every administrator. There are many command line tools made for this purpose. This guide will cover some of the more popular utilities for monitoring your VPS.
Submit an Answer