New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Need help optimising my vps
situnrocks
Member
in Help
Hi guys,
I'm using Wordpress with LEMP on bellow config VPS and the website goes extremely slow when reaches 500 live users.
VPS info:
System Info
Processor : Intel(R) Xeon(R) CPU E3-1230 V2 @ 3.30GHz
CPU Cores : 5
Frequency : 3300.182 MHz
Memory : 6144 MB
Swap : 0 MB
Uptime : 17 min,OS : CentOS release 5.11 (Final)
Arch : i686 (32 Bit)
Kernel : 2.6.32-042stab112.15
nginx.conf includes:
worker_processes 5;
worker_connections 1024;
php memory limit: 256mb
Please let me know what other config I should checkout.
Thanks.
Comments
Why you using 32-bit?
Using static caching on Wordpress? If not, that's a quick and easy answer to get the job done.
Caching most definetely if. you're not doing it already.
It looks like MySQL could do with more RAM also. 16MB. You should see how large your WP database is, if you can fit all the indexes into RAM, that should help.
IS your VPS have 6GB RAM?. For > 2 GB, better using 64bit for CentOS 6 instead 5.
nice, 1.5% idle
Since I'm using this vps from 2+ years not sure how to change OS version without server switching.
Well, you are wasting almost half of your RAM because of the 32 bit OS.
You mean:
"location ~* .(js|css|png|jpg|jpeg|gif|ico)$ {
"
About caching right now I'm using Cloudflare Business plan with static cache mode.
But as you can see there is a lot of free RAM, almost 80% free. So first of all need to lower the server load and other issues.
Nope. Something like WP Super Cache. Browser cache and cloud flare cache won't help much at all, this will change your life:
https://easyengine.io/wordpress-nginx/tutorials/single-site/wp-super-cache/
That means you need to do more caching and keep heavy tasks in RAM. Are you using redis/memcached or something similar? As someone said above, give more RAM to mysql. That combined with good caching will improve things drastically.
If still want stay with 32bit, make sure your kernel using PAE. Read https://www.centos.org/forums/viewtopic.php?t=27235
He's using PAE already. Otherwise system can't see more than 3.5/4 GB of RAM. So his screenshot of top obviously shows that PAE is in use.
I suggest running some network, disk, CPU & PHP benchmarks to close down where problem can be. It is entirely possible the network is the throttle and not your VPS hardware!
Post the results here
Using this script: freevps.us/downloads/nginx-centos-6.sh
Convert all your tables to InnoDB and set innodb buffer pool size to 1GB
Looks like, MySQL configuration is the next thing you should look into. The link below, explains the configuration variables that you need to change,
https://www.percona.com/blog/2006/09/29/what-to-tune-in-mysql-server-after-installation/
So much THIS! Static caching with Wordpress (either via Supercache's "Mod Rewrite" option (works fine with nginx, just use wordpress.org's nginx config examples) or W3TC static caching).
By preloading static .html/.gz files with Supercache or W3TC, php-fpm will never be called (unless you're in wp-admin or it's preloading the cache) and so you Wordpress site will be blazing fast because Nginx is handling everything and there's not much memory use because php-fpm isn't being called.
Here's my Leaseweb 1GB VPS running Wordpress and using Supercache set to static caching. 325680 responses within 1 minute using Loader.io.
Perhaps you haven't noticed the 97.6% mysqld part. Though it does not mean that your solution won't help, on the contrary it should.
just supercache. Preload everything and the job is done, you won't see more than 5-10 % cpu usage
You can also try fastcgi caching - see here: https://www.digitalocean.com/community/tutorials/how-to-setup-fastcgi-caching-with-nginx-on-your-vps
I agree that static caching is a good first option to reduce the need for php being run, which should result in less mysql-requests either, but...
...maybe have at look at what plugins you use and what those are doing. some do weird things like checking every 5 seconds for news/updates/chat-messages etc.
for such things static caching wont help, as this usually are js/ajax calls which end directly in doing a mysql request via php ... guess what happens with 500 live users, that are most probably not doing anything (other than reading content, which mostly will not cause that much requests)
have a look at some awstats or alike to see if there is some hard hitted php script or something like this to get on the right way of finding the cause, if caching won't help.
System Info
Processor : Intel(R) Xeon(R) CPU E3-1230 V2 @ 3.30GHz
CPU Cores : 5
Frequency : 3300.182 MHz
Memory : 6144 MB
Swap : 0 MB
Uptime : 6:09,
OS : CentOS release 5.11 (Final)
Arch : i686 (32 Bit)
Kernel : 2.6.32-042stab112.15
Location Provider Speed
CDN Cachefly 67.3MB/s
Atlanta, GA, US Coloat 76.0MB/s
Dallas, TX, US Softlayer 95.5MB/s
Seattle, WA, US Softlayer 50.3MB/s
San Jose, CA, US Softlayer 57.5MB/s
Washington, DC, US Softlayer 44.5MB/s
Tokyo, Japan Linode 11.9MB/s
you'd better hide your IP
I think because he's running 32-bit on a system with >4GB RAM.
I like that article, and was surprised to see it's 10 years old. Still relevant I think though.
Also, download and run http://mysqltuner.pl
But I agree that MySQL isn't your main issue.
>
First -- REMOVE your IP in the post.
Second, Read the statements complete and post results complete. Network seems good. but you did not post disk speed results from the script.
Any how... Pls mention these :
What Version of MySQL? mysql -V
Run this php benchmark & post score
>apt-get install ioping fio hdparm -y
Post fio results
You can clearly see 0% IO wait in his screenshot.
Disk Speed
I/O (1st run) : 274 MB/s
I/O (2nd run) : 200 MB/s
I/O (3rd run) : 194 MB/s
Average I/O : 222.667 MB/s
1.
'PHP 5.4.35 (cli) (built: Nov 19 2014 08:51:16)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
2.
mysql Ver 14.14 Distrib 5.5.40, for Linux (i686) using readline 5.1
Oh rly, clear. top doesn't say all that much, and while caching and reviewing WP plugins will undoubtedly help, issues like contention and relying on disk cache in kernel space rather than Mysql's caches in user space won't help performance. Reviewing his MySQL setup certainly won't hurt.
I'd recommend updating PHP to 5.6.x Will make a huge difference altogether.
ioping,hdparm, fio test still missing though