Howdy, Stranger!

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


Optimise memory usage for multiple WP and MySQL on single 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.

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 2020

    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
  • 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)

  • @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.

  • vyas11vyas11 Member
    edited August 2020

    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!

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

  • 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
  • raindog308raindog308 Administrator, Veteran

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

  • @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 2020

    @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
  • @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.

    Thanked by 1RustyKumar
  • 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
Sign In or Register to comment.