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?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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.
Click below to sign up and get $200 of credit to try our products over 60 days!
Enter your email to get $200 in credit for your first 60 days with DigitalOcean.
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
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.
You can exacute
htopvia 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
topcomes installed by default and you might need to install htop.
```sudo apt-get install htop``
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:
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 ):
To check the cpu usage:
You can also check this tutorial for monitoring the CPU usage on your droplet:
You can also track the performance with the Droplet Graphs which are available in your control panel. You can find more information here:
Hope this helps!
Question did you find a solution for your issue, seems like year by year droplet are become more useless…
I’m just posting the typical issues/resolutions to such cases. They are almost every time connected with two things - Website Optimization and Server/Droplet Optimization.
Let’s start with Server Optimization.
When looking at Server/Droplet Optimization, there are a few necessary services/packages that are universal.
The first one would be Server-side caching. Server cache is an umbrella term covering a number of different types of caching. This includes Content Delivery Network (CDN) caching, object caching, and opcode caching. Depending on what you want to achieve you might need one or the other. Usually, though, you can have all 3 types of caching as it shouldn’t interfere with your Website/App. I won’t go into more details about what each caching does as this post will become 3 pages long. There are multiple documents providing services/packages for each of the server-type caching.
Next would be using PHP-FPM (if your Website is using PHP of course). PHP-FPM is an efficient method on how to minimize the memory consumption and rise the performance for the Websites with heavy traffic. It is significantly faster than traditional CGI-based methods in multi-user PHP environments.
Another solution would be Database Caching. A database cache supplements your primary database by removing unnecessary pressure on it, typically in the form of frequently accessed read data. The cache itself can live in a number of areas including your database, application or as a standalone layer. Usually, for this kind of caching is being used Redis.
Apache NPM modules. If you are using Apache, you are using one of three NPM modules. Most certainly if you haven’t configured anything on it and have used the default configuration, you are using NPM_Prefrok which is the most outdated one and thus the slower. I’ll recommend using one of the other two - NPM_Worker and NPM_Event depending on your situation. Again, I would urge you to read more about these 3 and what is applied in which case.
Apache Workers. Basically, the Apache workers are equivalent to a room full of seats. These seats are the projection to your website. When someone opens your website, it’s like one person going to this room and sitting on one of the chairs. When the limit is reached, in order for a person to load your website, another one needs to close it. So basically, I’ll suggest increasing that value as well.
Those were the basic optimizations on a server level, let’s start with your Website/App
If you are using a CMS like WordPress, Magento, Joomla, Opencart or anything of the same matter, there will be plugins/addons. These addons can be very powerful if used correctly. The most helpful plugins are:
If you are not using a CMS, you’ll need to try and do what these plugins are doing manually.
Usually, Websites/Apps are slow because of a couple of reasons which range from too many requests or big images to a bunch of unnecessarily big JS or CSS files. Optimizing these whether you are using a Plugin or doing it manually is enough.
I hope this was helpful.