Optimizing for 4GB VPS
Optimizing for 4GB VPS
I use a 4GB DigitalOcean droplet with VestaCP to host 10 WordPress websites. What's the best way to determine if my server can handle more websites?
I was running out of RAM and so I limited the number of httpd processes using Apache prefork:
In this file:
vi /etc/httpd/conf/httpd.conf
Added this:
<IfModule prefork.c>
ServerLimit 35
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 35
MaxConnectionsPerChild 75
</IfModule>
And the number of fastcgi processes:
In this file:
vi /etc/httpd/conf.d/fcgid.conf
Added this:
FcgidMaxProcesses 25
I check the memory useage regularly and I still have about 25% of RAM available. Does this mean I can host more websites on the server?
Or is there a way to view the total number of website requests the server handles in order to make a better calculation and decision?
Thanks in advance.
I was running out of RAM and so I limited the number of httpd processes using Apache prefork:
In this file:
vi /etc/httpd/conf/httpd.conf
Added this:
<IfModule prefork.c>
ServerLimit 35
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 35
MaxConnectionsPerChild 75
</IfModule>
And the number of fastcgi processes:
In this file:
vi /etc/httpd/conf.d/fcgid.conf
Added this:
FcgidMaxProcesses 25
I check the memory useage regularly and I still have about 25% of RAM available. Does this mean I can host more websites on the server?
Or is there a way to view the total number of website requests the server handles in order to make a better calculation and decision?
Thanks in advance.
-
- Support team
- Posts: 1096
- Joined: Sat Sep 06, 2014 9:58 pm
- Contact:
- Os: Debian 8x
- Web: apache + nginx
Re: Optimizing for 4GB VPS
The first things you need to account for your server is :
1. your TOTAL daily visits
2. Peak Simultaneous visits
3. Daily Average bandwidth consumption
Then watch IOSTAT as well as RAM and CPU usage while the Peak times and daily overall load average.
Sign up with NewRelic Server monitoring and install their client, it will help you gather good stats.
Presumptions are not good in sysadmin work and Limiting Apache threads (if you are not using Nginx as Rev. proxy) means you will be kicking out visitors... seems stupid!!
Running out of RAM can also mean your site(s) have something malicious or some plugin/theme is misbehaving.
Again, I'm not presuming anything... the best way is to gather stats and have numbers to see if the server is the bottleneck or is having a problem. A complete audit of your server is required in the latter case.
1. your TOTAL daily visits
2. Peak Simultaneous visits
3. Daily Average bandwidth consumption
Then watch IOSTAT as well as RAM and CPU usage while the Peak times and daily overall load average.
Sign up with NewRelic Server monitoring and install their client, it will help you gather good stats.
Presumptions are not good in sysadmin work and Limiting Apache threads (if you are not using Nginx as Rev. proxy) means you will be kicking out visitors... seems stupid!!
Running out of RAM can also mean your site(s) have something malicious or some plugin/theme is misbehaving.
Again, I'm not presuming anything... the best way is to gather stats and have numbers to see if the server is the bottleneck or is having a problem. A complete audit of your server is required in the latter case.
Re: Optimizing for 4GB VPS
Thanks for taking the time to reply.
I am using nginx as a reverse proxy. I understand your point about not limiting threads to not kick out visitors. However it seemed like the default Vesta config was allowing too many to be spawned, and I was running out of RAM, so I didn't know what else to do. The sites are clean wordpress installs with no malicious code. But perhaps a theme or plugin on one or more of the sites is demanding too much of the system. Any idea where I might start finding, first of all, which of the hosted sites are using up the most resources (then I could look more closely at why)?
Your first three points seem to be exactly what I need to get started. Is your suggestion of Newrelic server monitoring the only way to achieve this? Are there other ways to gather this info on my VPS without subscribing to such a service?
Again, thanks for your help. It's much appreciated.
I am using nginx as a reverse proxy. I understand your point about not limiting threads to not kick out visitors. However it seemed like the default Vesta config was allowing too many to be spawned, and I was running out of RAM, so I didn't know what else to do. The sites are clean wordpress installs with no malicious code. But perhaps a theme or plugin on one or more of the sites is demanding too much of the system. Any idea where I might start finding, first of all, which of the hosted sites are using up the most resources (then I could look more closely at why)?
Your first three points seem to be exactly what I need to get started. Is your suggestion of Newrelic server monitoring the only way to achieve this? Are there other ways to gather this info on my VPS without subscribing to such a service?
Again, thanks for your help. It's much appreciated.
-
- Support team
- Posts: 1096
- Joined: Sat Sep 06, 2014 9:58 pm
- Contact:
- Os: Debian 8x
- Web: apache + nginx
Re: Optimizing for 4GB VPS
Yes there are other ways...Monit, Munin, Nagios, etc. You'll have to do some good reading and try out different things
HetrixTools or NewRelic are simpler for new comers... you'll be better off with them.
As for the malicious content suspicion, it again is a series of process.
Search the forums for pointers... Start with :
1. exim -bpc (see if your server is generating SPAM
2. Install Maldet and scan your /home/ directory.
Tip:
try stopping your sites in sets of 2 each... keep them off and watch your server's resources with htop. you will be able to pin down if one of the websites is being the ass.
Good luck.
HetrixTools or NewRelic are simpler for new comers... you'll be better off with them.
As for the malicious content suspicion, it again is a series of process.
Search the forums for pointers... Start with :
1. exim -bpc (see if your server is generating SPAM
2. Install Maldet and scan your /home/ directory.
Tip:
try stopping your sites in sets of 2 each... keep them off and watch your server's resources with htop. you will be able to pin down if one of the websites is being the ass.
Good luck.
Re: Optimizing for 4GB VPS
Thanks for this added info. I'll look into those tools but will also consider your point that newrelic is a simpler way for me to get started.
I'll also try the malicious code steps you suggested.
Lastly, thanks for the advice on seeing which of my hosted sites uses up the most resources. I'm reluctant to take down a client site for that, but if it's the only way I'll do it late at night one day. Besides using Analytics to count visitors, is there no tool that allows someone to see which hosted website (which Linux user) is using up the most resources over, say, a 24-hour period?
Thanks again.
I'll also try the malicious code steps you suggested.
Lastly, thanks for the advice on seeing which of my hosted sites uses up the most resources. I'm reluctant to take down a client site for that, but if it's the only way I'll do it late at night one day. Besides using Analytics to count visitors, is there no tool that allows someone to see which hosted website (which Linux user) is using up the most resources over, say, a 24-hour period?
Thanks again.
-
- Support team
- Posts: 1096
- Joined: Sat Sep 06, 2014 9:58 pm
- Contact:
- Os: Debian 8x
- Web: apache + nginx
Re: Optimizing for 4GB VPS
Google Analytics is your best and precise reporting tool. Interestingly, REAL TIME visitors View is a good key to show simultaneous connections.
Last edited by mehargags on Sun Mar 05, 2017 3:04 pm, edited 2 times in total.
Re: Optimizing for 4GB VPS
Ok great. Thanks again.
Re: Optimizing for 4GB VPS
Your comment about kicking out users being stupid makes a lot of sense to me, so I don't really know what to do now.
Since I believe this is a separate topic altogether, I have posted it here:
viewtopic.php?f=11&t=14046
Thanks again.
Since I believe this is a separate topic altogether, I have posted it here:
viewtopic.php?f=11&t=14046
Thanks again.
Re: Optimizing for 4GB VPS
To be continued
viewtopic.php?f=11&t=14046
viewtopic.php?f=11&t=14046