Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Web Server
  • Search

Optimizing for 4GB VPS

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Locked
  • Print view
Advanced search
9 posts • Page 1 of 1
vesta_mtl
Posts: 70
Joined: Wed Dec 21, 2016 2:08 pm

Optimizing for 4GB VPS

Post by vesta_mtl » Sat Mar 04, 2017 4:14 pm

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.
Top

mehargags
Support team
Posts: 1096
Joined: Sat Sep 06, 2014 9:58 pm
Contact:
Contact mehargags
Website Skype

Os: Debian 8x
Web: apache + nginx
Re: Optimizing for 4GB VPS

Post by mehargags » Sat Mar 04, 2017 5:11 pm

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.
Top

vesta_mtl
Posts: 70
Joined: Wed Dec 21, 2016 2:08 pm

Re: Optimizing for 4GB VPS

Post by vesta_mtl » Sat Mar 04, 2017 6:54 pm

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.
Top

mehargags
Support team
Posts: 1096
Joined: Sat Sep 06, 2014 9:58 pm
Contact:
Contact mehargags
Website Skype

Os: Debian 8x
Web: apache + nginx
Re: Optimizing for 4GB VPS

Post by mehargags » Sat Mar 04, 2017 7:51 pm

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.
Top

vesta_mtl
Posts: 70
Joined: Wed Dec 21, 2016 2:08 pm

Re: Optimizing for 4GB VPS

Post by vesta_mtl » Sat Mar 04, 2017 8:37 pm

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.
Top

mehargags
Support team
Posts: 1096
Joined: Sat Sep 06, 2014 9:58 pm
Contact:
Contact mehargags
Website Skype

Os: Debian 8x
Web: apache + nginx
Re: Optimizing for 4GB VPS

Post by mehargags » Sun Mar 05, 2017 9:54 am

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.
Top

vesta_mtl
Posts: 70
Joined: Wed Dec 21, 2016 2:08 pm

Re: Optimizing for 4GB VPS

Post by vesta_mtl » Sun Mar 05, 2017 1:20 pm

Ok great. Thanks again.
Top

vesta_mtl
Posts: 70
Joined: Wed Dec 21, 2016 2:08 pm

Re: Optimizing for 4GB VPS

Post by vesta_mtl » Mon Mar 06, 2017 2:45 pm

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.
Top

skurudo
VestaCP Team
Posts: 8099
Joined: Fri Dec 26, 2014 2:23 pm
Contact:
Contact skurudo
Website Facebook Google+ Skype
Twitter

Re: Optimizing for 4GB VPS

Post by skurudo » Tue Mar 07, 2017 8:41 am

To be continued
viewtopic.php?f=11&t=14046
Top


Locked
  • Print view

9 posts • Page 1 of 1

Return to “Web Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password