Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Cloudron Forum

Apps | Demo | Docs | Install

Set php.ini memory allocation to match Cloudron memory allocated

Scheduled Pinned Locked Moved WordPress (Developer)
10 Posts 4 Posters 80 Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • marcusquinnM Offline
    marcusquinnM Offline
    marcusquinn
    wrote last edited by
    #1

    Prob a Q for @girish

    It seems Wordpress doesn't recognised the allocated memory from the Cloudron app memory allocation, so it needs setting in php.ini with:

    memory_limit = 2048M
    

    or whatever value.

    Perhaps this should be set and updated to keep in sync with the Cloudron app memory allocation setting?

    04033830-4a5e-44b6-b16b-c2b6d2838229-image.png

    We're not here for a long time - but we are here for a good time :)
    Jersey/UK
    Work & Ecommerce Advice: https://brandlight.org
    Personal & Software Tips: https://marcusquinn.com

    1 Reply Last reply
    3
  • girishG Offline
    girishG Offline
    girish Staff
    wrote last edited by
    #2

    The app's memory limit is actually spread over the apache instances. The number of apache instances in turn comes from the apache configuration. The number of apache instances at a time is dynamic based on how many servers you keep running non-stop and how many you recycle. After that, each apache loads mod_php and mod_php uses the php memory to run the PHP VM. It's not straightforward to map the container memory limit into php memory limit.

    micmcM 1 Reply Last reply
    2
  • robiR Offline
    robiR Offline
    robi
    wrote last edited by
    #3

    Time for a more memory efficient webserver?

    Life of sky tech

    1 Reply Last reply
    0
  • girishG Offline
    girishG Offline
    girish Staff
    wrote last edited by
    #4

    I think it's just the way things work. Apache is quite efficient.

    marcusquinnM 1 Reply Last reply
    0
  • marcusquinnM Offline
    marcusquinnM Offline
    marcusquinn
    replied to girish last edited by
    #5

    @girish OK, I didn't spot anything in the documentation, but maybe worth adding a line, as we thought WP had all the memory allocated to play with, but was only using 256MB without that being set in the php.ini, which caused cron jobs to fail, as they run out of memory, as tending to do more memory intense things.

    We're not here for a long time - but we are here for a good time :)
    Jersey/UK
    Work & Ecommerce Advice: https://brandlight.org
    Personal & Software Tips: https://marcusquinn.com

    1 Reply Last reply
    1
  • micmcM Offline
    micmcM Offline
    micmc
    replied to girish last edited by
    #6

    @girish said in Set php.ini memory allocation to match Cloudron memory allocated:

    The app's memory limit is actually spread over the apache instances. The number of apache instances in turn comes from the apache configuration. The number of apache instances at a time is dynamic based on how many servers you keep running non-stop and how many you recycle. After that, each apache loads mod_php and mod_php uses the php memory to run the PHP VM. It's not straightforward to map the container memory limit into php memory limit.

    Huh? To clarify things a little more, does that mean that, after all, it's still better to adjust memory settings in php.ini for PHP apps?
    Honestly, I understand the part that loads the required memory to run the PHP app through the Apache instance, but from your explanation it's not clear, for me at the very least, on how exactly the memory allocation feature of Cloudron, interacts with the VM's memory finally... 🙄


    https://marketingtechnology.agency
    For cutting edge web technologies

    marcusquinnM girishG 2 Replies Last reply
    0
  • marcusquinnM Offline
    marcusquinnM Offline
    marcusquinn
    replied to micmc last edited by
    #7

    @micmc Correct. Surprised me, too, but that's the way it is. Thought to post, as I think it's obscure enough that most wouldn't have noticed.

    Install the Query Monitor Plugin in Wordpress and look at the output before and after adding this setting and restarting the app, and you'll see what I mean.

    We're not here for a long time - but we are here for a good time :)
    Jersey/UK
    Work & Ecommerce Advice: https://brandlight.org
    Personal & Software Tips: https://marcusquinn.com

    micmcM 1 Reply Last reply
    2
  • girishG Offline
    girishG Offline
    girish Staff
    replied to micmc last edited by girish
    #8

    @micmc If it helps: setting memory limit for an app (at the Cloudron level) is like creating a virtual server with that much memory. So, if you allocate 2GB, it's like creating a 2GB server. Inside this 2GB server, there is apache running.

    <eli5>
    Apache is run in forking mode - for each PHP request there is an apache process in the server. So, if a site makes 10 requests in parallel, there are 10 apache processes running. These 10 apache processes have to live within the 2GB server you created above.

    Each of these processes can be doing simple to very complex things. Maybe one is just a healthcheck.php, do_simple_thing.php or do_complex_things.php . The php.ini memory_limit (which is 128MB by default) is the max that the apache process can take. Note that healthcheck can be just 1MB, do_simple_thing can be 50MB and we can have 30 of these concurrently, but just one do_complex_thing with 128MB. Basically, all sorts of combinations can exist as long as < 2GB. It depends on the app.
    </eli5>

    I was originally trying to say that you cannot map 2GB to the app's max task memory limit. These have to be configured by the app author / cloudron sysadmin because this depends on the app and also how you have configured in apache.

    micmcM 1 Reply Last reply
    3
  • micmcM Offline
    micmcM Offline
    micmc
    replied to marcusquinn last edited by
    #9

    @marcusquinn said in Set php.ini memory allocation to match Cloudron memory allocated:

    Install the Query Monitor Plugin in Wordpress and look at the output before and after adding this setting and restarting the app, and you'll see what I mean.

    Thanks. Will try for sure.


    https://marketingtechnology.agency
    For cutting edge web technologies

    1 Reply Last reply
    0
  • micmcM Offline
    micmcM Offline
    micmc
    replied to girish last edited by micmc
    #10

    @girish said in Set php.ini memory allocation to match Cloudron memory allocated:

    @micmc If it helps: setting memory limit for an app (at the Cloudron level) is like creating a virtual server with that much memory. So, if you allocate 2GB, it's like creating a 2GB server. Inside this 2GB server, there is apache running.

    Wow, that's amazing!
    And, with the rest of the explanation, it makes it more clear of how this works and how we can better know what we are doing while trying to cope with apps' memory.


    https://marketingtechnology.agency
    For cutting edge web technologies

    1 Reply Last reply
    1

  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Login

  • Don't have an account? Register

  • Login or register to search.