Howdy, Stranger!

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

Advertise on LowEndTalk.com
Optimise memory usage for multiple WP and MySQL on single VPS
New on LowEndTalk? Please read our 'Community Rules' by clicking on it in the right menu!

Optimise memory usage for multiple WP and MySQL on single VPS

zserozsero Member

Hi,

I've migrated all my Wordpress sites to docker-compose based configs, basically one site is one directory, totally separeted in it's docker container. My compose file is based on this project:

https://github.com/nezhar/wordpress-docker-compose/blob/master/docker-compose.yml

This starts one Apache + PHP + MySQL per wordpress site. It works well, however I'd like to optimise it for better memory usage. I'm running 5 very low traffic WP sites on a 2 GB VPS and it's using 1.9 GB memory + 4 GB swap on vm.swappiness = 10.

What would you recommend for php config / mysql config to optimise it? I know sharing the MySQL instance would be a good optimisation, but I don't want to give up on the separate directory / separate container if possible. It's just great that I can manage all the sites 100% independently from each other.

Comments

  • edited August 31

    Lol, better you install webinoly or any lnmp stack, nginx + php 7.4 + mariadb and redis (optional), currently using webinoly with nginx fast cache enabled for 6 WP sites with standard traffic, on a 2 GB VPS, memory usage ~900 MB and almost no swap..

    Thanked by 1vyas11

    A simple uptime dashboard using UptimeRobot API https://upy.baubus.uk
    Currently using VPS from BuyVM, HostHatch, HostSailor, HostSolutions, LiteServer, MaxKVM, MrVM, ServaRICA, VirMach.

  • that's a lot of RAM usage for a low traffics WP site. Better switch to nginx + mariadb.

  • Or WordOps (Fork of EasyEngine v3 - optimized and more features)

  • zserozsero Member

    @jahrinc said:

    Or WordOps (Fork of EasyEngine v3 - optimized and more features)

    This WordOps looks promising!

  • @zsero said:

    @jahrinc said:

    Or WordOps (Fork of EasyEngine v3 - optimized and more features)

    This WordOps looks promising!

    Been using it for over a year, solid so far!

  • I used to run centminmod until I leave wordpress.

    Coffee, please.

  • vyas11vyas11 Member
    edited August 31

    Word ops also uses docker since that is what you have already setup...

    Webinoly is sweet I use it for personal projects...had a lot of fun running it on a tinykvm. Worked surprisingly well!

  • zserozsero Member

    I've migrated everything to Wordops, full system is at 480 MB now, nothing in swap.

    Thanked by 1jahrinc
  • pbxpbx Member

    @vyas11 said: Word ops also uses docket, since that is what you have already setup...

    Are you sure it uses docker? It's a fork of EEv3 made by some people who didn't like the fact that it was becoming bloatware...

    @zsero said: I've migrated everything to Wordops, full system is at 480 MB now, nothing in swap.

    Nice, but it seems like it's based on nginx vhosts rather than containers. As each sites are using different php-fpm users and stuff like that you should be fine though. Docker containers don't provide bulletproof isolation anyway, a well configured stack is secure enough for most uses.

  • FalzoFalzo Member

    while you seem to have found your solution... if you run multiple instances of same services in parallel maybe give KSM (kernel samepage merging) a chance to win some memory back.

    Thanked by 1raindog308

    UltraVPS.eu KVM in US/UK/NL/DE: 15% off first 6 month | Netcup VPS/rootDS - 5€ off: 36nc15279180197 (ref)

  • raindog308raindog308 Administrator, Moderator

    @Falzo said: while you seem to have found your solution... if you run multiple instances of same services in parallel maybe give KSM (kernel samepage merging) a chance to win some memory back.

    I thought that was always on. It's been around since 2.6. I didn't do anything special to enable it and my /boot/config-* says CONFIG_KSM=y on a generic Debian 9 box.

    For LET support, please visit the support desk.

  • zserozsero Member

    @pbx said: As each sites are using different php-fpm users and stuff like that you should be fine though.

    I'm not sure it does, at least on my server every process is by www-data user.

  • pbxpbx Member

    @zsero said:

    I'm not sure it does, at least on my server every process is by www-data user.

    Interesting, thanks. Never tried it but it looked interesting. IMO there is no reason why you would have all your php-fpm processes running with the same user.

  • FalzoFalzo Member
    edited August 31

    @raindog308 said:

    @Falzo said: while you seem to have found your solution... if you run multiple instances of same services in parallel maybe give KSM (kernel samepage merging) a chance to win some memory back.

    I thought that was always on. It's been around since 2.6. I didn't do anything special to enable it and my /boot/config-* says CONFIG_KSM=y on a generic Debian 9 box.

    this just shows if your kernel supports it ;-) you can check via

    cat /sys/kernel/mm/ksm/run
    cat /sys/kernel/mm/ksm/pages_shared

    but for regular server with debian/ubuntu I would be surpised if that's running. afaik you still need to install the service, should be part of the ksmtuned package or so...

    Thanked by 2pbx raindog308

    UltraVPS.eu KVM in US/UK/NL/DE: 15% off first 6 month | Netcup VPS/rootDS - 5€ off: 36nc15279180197 (ref)

  • vyas11vyas11 Member

    @pbx said:

    @vyas11 said: Word ops also uses docket, since that is what you have already setup...

    Are you sure it uses docker? It's a fork of EEv3 made by some people who didn't like the fact that it was becoming bloatware...

    You are right, I stand corrected. EE4 is doker based indeed.

  • +1 for wordops. I use it to deploy more than 10 wordpress installations in a low specs VPS with 512 MB memory.

  • Apache (php-fpm + suEXEC) + Percona + Memcache(d) + PHP 7.4. That's all you need. Don't go to fancy with low traffic websites. Avoid premature headaches.

    With mentioned setup you can easily push 10 websites for each 1 GB/1 CPU you have.

    Thanked by 1pbx

    hostWP.net -- Free Wordpress Hosting!

Sign In or Register to comment.