VPS optimization question

krnekdo

New Member
Hi all,

I have a website that gets a fair amount of traffic, but on occasions the traffic spikes are very big. Think 4,000 people on the site at the same time.. Here is my current VPS setup an SSD4 package:

Do you guys suggest any other improvements/changes? I noticed at a peak of 4k visitors that I had problems logging into my email through cpanel and editing a post due to a database error. It said too many connections. Is there any way to optimize this as well?

Also, would you suggest changing from Nginx to Varnish maybe?

Any suggestions would be greatly appreciated!
 
Hi,

You have the exact same set up as I do, except that I am not running memcached. You might get a tiny improvement by updating to PHP 5.6.15, as 5.6 outperforms 5.5 slightly (PHP 7 will be awesome at 2 to 3X performance of 5.6, when it is released and mainstream).

LiteSpeed is a drop in replacement for Apache, and everything I have read indicates it is a much faster performer. It is not free though.

I also have read that Redis is a better performer than Memcached. You might want to try it.

Is is a WordPress site, or other?
 
Start using PHP-FPM and MPM-Event, and you can say goodbye to archaic stuff like mod_php and MPM-Prefork. ;) The huge memory hit of nginx also goes away because, without being forced to load PHP when serving static content, Apache with MPM-Event is 90-95% of the speed of nginx (depending on configuration).

PHP 5.6 slightly outperforms PHP 5.5 at the expense of 15% more memory usage. Something to keep in mind if one has a small VPS.

I've been running PHP 7.0 on a development server since its alpha days. It is much faster than previous versions of PHP, and is uses 30-40% less memory. But...it is going to break a lot (and I mean a LOT) of older scripts. WordPress runs fine, though quite a few plugins and themes do not work. Most current board software does not work and will need varying degrees of modification.
 
Start using PHP-FPM and MPM-Event, and you can say goodbye to archaic stuff like mod_php and MPM-Prefork.

Dion is absolutely correct. If you have just one site (and do not need to roll out multiple cPanel accounts quickly), using PHP-FPM is the way to go. Setting it up and getting it working is a bit of an adventure though, I believe.
 
Thank you guys. I am running a Wordpress site, yes.

Start using PHP-FPM and MPM-Event, and you can say goodbye to archaic stuff like mod_php and MPM-Prefork. ;) The huge memory hit of nginx also goes away because, without being forced to load PHP when serving static content, Apache with MPM-Event is 90-95% of the speed of nginx (depending on configuration).

I asked for MPM-Event but I was told that DSO + mod_ruid2 are not compatible with MPM-Event and that is why they installed Prefork for me. I don't know PHP-FPM. Is it compatible with my current PHP version? Would upgrading the PHP version to 5.6 make it compatible with MPM-Event?

We had Litespeed installed on the previous server but it was very slow. But now I think it was slow due to the PHP, we had SuPHP and it couldn't even handle 1k uvs at the same time..

What I am trying to achieve is to be able to have from 7-10k people on the site at the same time. At the moment the top spike showed 4,1k people on the site and it was starting to run very slow with that number of people. Do you guys think that an SSD4 or SSD5 package can handle such traffic loads if configured correctly?
 
Hi
Would upgrading the PHP version to 5.6 make it compatible with MPM-Event?
Not sure about that, but I think not. Upgrading to PHP 5.6 is probably a good thing overall though, as 5.5 version is already at security updates only.
Dion can probably give you detailed information about PHP-FPM. But to my knowledge, PHP-FRP setup requires some manual configuration. Dion may have the steps to set up PHP-FPM handy, I don't know.

Do you guys think that an SSD4 or SSD5 package can handle such traffic loads if configured correctly?
More RAM/memory is ALWAYS beneficial when the VPS is under heavy load. More memory sure can't hurt your chances of improving performance.
 
Oh and one more thing, I bought a CDN to boost the config a bit further. I don't know if that has any effects on the config..
 
Oh and one more thing, I bought a CDN to boost the config a bit further. I don't know if that has any effects on the config..
CDN has no impact on the server stack/config, but it will help your site some by allowing assets (images, css, js) to load via the CDN instead of your KH server. This will reduce load on your VPS, and also reduce bandwidth used. A CDN has always improved every sites performance that I have used one on...
 
CDN has no impact on the server stack/config, but it will help your site some by allowing assets (images, css, js) to load via the CDN instead of your KH server. This will reduce load on your VPS, and also reduce bandwidth used. A CDN has always improved every sites performance that I have used one on...

Yeah I grabbed a CDN to reduce the load from the VPS and try to add that as an extra edge to be able to get even more traffic when they will come..
 
PHP-FPM is great for large sites, and you will then be able to use MPM-Event. The biggest thing to remember about PHP-FPM on busy sites is that, unlike all other PHP handlers, it is very good with CPU and is blazing fast...as long as it has enough memory to run in "dynamic" or (preferably) "static" mode.

It is also great for small sites when set up in "ondemand" mode. In fact, those with a KH SSD-1 or VPS-1 would see a slight improvement in performance along with significantly reduced memory usage.

Setting up PHP-FPM is straightforward if there will only be one user. You can get EasyApache3 (stay away from EA4 for now!) to spit out a working PHP-FPM if you give it the raw options to compile Apache with mod_pxoxy_fcgi and to compile PHP with FPM enabled. You would then need to create a pre_virtualhost_global.conf file for Apache that sets up the PHP-FPM handler. Next would be creating your php-fpm.conf file, which is probably the most difficult thing to do since it must be customized for your site. And finally, you would need to set the PHP handler in cPanel to None since you will be using a custom handler.

I have PHP-FPM running on my SSD-2 VPS and it's blazing fast. I've also noticed that PHP-FPM works better with Zend OPcache than do the other PHP SAPIs.
 
I should clarify my terminology since it is different than yours. What you call "site" is what I call "domain". PHP-FPM is straightforward to set up for unlimited domains as long as the domains are managed by a single cPanel/linux user. If you have multiple users, meaning there are directories like /home/user1 and /home/user2, then setting up PHP-FPM requires more work because each user must have its own configuration ("pool" in FPMspeak).
 
Could we set it up only for one user? As the other sites are smaller ones.. Because we do have have each domain under a different user.
 
PHP-FPM could be set up for a single domain, or all domains controlled by a single user. In that case you would only need one "pool" and the configuration would be much easier. Please be aware that it will not be as fast as it would if it were the only PHP handler, and your main PHP cannot run as a DSO. That means in your case, you must reconfigure PHP to FastCGI if you want to try out PHP-FPM.

Please note that at the present time, you must use EasyApache 3 to create a working PHP-FPM. If you enabled EasyApache 4, then you will need to wait until PHP-FPM is properly supported, or revert to EasyApache 3.

(Side note: EA4 sucks. :) If you want to build in something not provided by cPanel, you must compile and build an RPM, then create your own personal YUM repo. Ugh.)
 
From the actual script to enable EA4:
This action will install a Technology Preview release of EasyApache4 for cPanel & WHM. This means that you understand the following:
• Not all features in cPanel & WHM are operational.
• Not all EasyApache features are included in the Technology Preview.
• Features and functionality in the release may change over time.
• We will quickly address severe or critical issues only.
• Security bounties are not available.

Technology Preview = Beta
 
Agreed that EA4 is still in beta, but even after it's in general release, it will still suck for the reason I gave. :)

EA4 is going to be great for the support departments of hosting companies. However, it's going to be a step backwards for the end user. If an end-user wants to load a custom Apache module such as mod_remoteip or mod_wsgi, they must play games with YUM/RPM. It will no longer be possible to link PHP to alternate libraries -- meaning, for example, you're stuck with an older version of PCRE that has security issues and was compiled with no JIT support.
 
Top