Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Need help optimising my vps
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.

Need help optimising my vps

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.

«1

Comments

  • MikeAMikeA Member, Patron Provider

    Why you using 32-bit?

  • jarjar Patron Provider, Top Host, Veteran

    Using static caching on Wordpress? If not, that's a quick and easy answer to get the job done.

    Thanked by 1sin
  • 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 :D

  • @mustafaramadhan said:
    IS your VPS have 6GB RAM?. For > 2 GB, better using 64bit for CentOS 6 instead 5.

    Since I'm using this vps from 2+ years not sure how to change OS version without server switching.

  • @situnrocks said:
    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.

  • @jarland said:
    Using static caching on Wordpress? If not, that's a quick and easy answer to get the job done.

    You mean:

    "location ~* .(js|css|png|jpg|jpeg|gif|ico)$ {

    expires 1y;
    

    "

    About caching right now I'm using Cloudflare Business plan with static cache mode.

  • @Junkless said:

    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.

  • jarjar Patron Provider, Top Host, Veteran

    @situnrocks said:
    About caching right now I'm using Cloudflare Business plan with static cache mode.

    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/

  • @situnrocks said:
    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.

    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

    Thanked by 1Junkless
  • ProfforgProfforg Member
    edited March 2016

    mustafaramadhan said: 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.

  • mehargagsmehargags Member
    edited March 2016

    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

    wget https://freevps.us/downloads/bench.sh

    chmod +x bench.sh

    ./bench.sh

  • @Junkless said:
    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.

    Using this script: freevps.us/downloads/nginx-centos-6.sh

  • exception0x876exception0x876 Member, Host Rep, LIR

    Convert all your tables to InnoDB and set innodb buffer pool size to 1GB

  • dg51dg51 Member

    situnrocks said: Please let me know what other config I should checkout.

    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/

  • sinsin Member
    edited March 2016

    @jarland said:
    Using static caching on Wordpress? If not, that's a quick and easy answer to get the job done.

    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.

  • exception0x876exception0x876 Member, Host Rep, LIR

    @amarc said:
    Edit: not sure how can some sugest mysql,RAM or anything other when it's clear from picture what is issue

    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

    Thanked by 1sin
  • FalzoFalzo Member

    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.

    Thanked by 2Geekoine jar
  • situnrockssitunrocks Member
    edited March 2016

    @mehargags said:
    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

    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

    Thanked by 1situnrocks
  • raindog308raindog308 Administrator, Veteran

    amarc said: Edit: not sure how can some sugest mysql,RAM or anything other when it's clear from picture what is issue

    I think because he's running 32-bit on a system with >4GB RAM.

    dg51 said: Looks like, MySQL configuration is the next thing you should look into. The link below, explains the configuration variables that you need to change,

    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.

  • mehargagsmehargags Member
    edited March 2016

    @situnrocks said:

    >
    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 :

    1. What Version of PHP are you running ? php -v
    2. What Version of MySQL? mysql -V

    3. Run this php benchmark & post score

    unzip bench.zip && rm -f bench.zip && mv bench.php phpbench.php

    php phpbench.php

    1. Disk I/O Check
      >apt-get install ioping fio hdparm -y

    ioping -c 10 .

    hdparm -tT /dev/vda1

    Post fio results

  • exception0x876exception0x876 Member, Host Rep, LIR

    @mehargags said:
    Disk I/O Check

    You can clearly see 0% IO wait in his screenshot.

    Thanked by 1jar
  • @mehargags said:
    Post fio results

    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

  • amarc said: php-fpm sucks.period. Who ever says it's good, has either unlimited budget for hardware or has 50 visit's per day. I run 1200-1500 live users (per GA) on 3euros VPS from Leaseweb. Both mod_fcgid+Apache2.4 or nginx+hhvm are 1000x better than any php-fpm setup.

    Edit: not sure how can some sugest mysql,RAM or anything other when it's clear from picture what is issue

    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

Sign In or Register to comment.