Howdy, Stranger!

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


PHP 8.2 memory consumption now becomes insane.
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.

PHP 8.2 memory consumption now becomes insane.

JustPfffJustPfff Member
edited February 2023 in General

Hi all,
with the newest PHP release 8.2 I notice the RAM consumption went too high here you can see 4 PHP-fpm process eat 80% of my VPS memory:-

USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
nginx        735  0.0 21.0 861116 166412 ?       S    00:13   0:41 php-fpm: pool www
nginx        733  0.0 20.2 855976 160296 ?       R    00:13   0:43 php-fpm: pool www
nginx        740  0.0 19.8 847684 156652 ?       S    00:13   0:41 php-fpm: pool www
nginx        737  0.0 19.7 848652 156164 ?       S    00:13   0:41 php-fpm: pool www

My server had ~1GB of RAM, running WordPress, and php-fpm now uses 80% of it, with only 4 fixed pools, before I tweak it, my server went down every couple hours, since my server can't handle more than 4 instance of PHP.

If I had a more popular website with thousands of visitors, e.g. hundreds of them connecting at the same time, how much of RAM would you think PHP will be required?

Comments

  • Something is definitely wrong in your config

  • No problem for me.

  • I have used php8.1 with latest version of wordpress (wp 6.1 as i remember) and got errors when uploaded an image on media.

    So i still stuck with php7.4 for all of my wp for now.

  • JustPfffJustPfff Member
    edited February 2023

    @AuroraZero said: Something is definitely wrong in your config

    It was PHP JIT setting I reduce opcache.jit_buffer_size to =20M from 128M but still not that much reduced.

    USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
    nginx      19945  0.3  9.1 677924 72188 ?        S    18:44   0:01 php-fpm: pool www
    nginx      19948  0.2  7.6 673252 60524 ?        S    18:44   0:01 php-fpm: pool www
    nginx      19947  0.2  7.4 672960 59200 ?        S    18:44   0:00 php-fpm: pool www
    root       19944  0.0  3.9 660916 31068 ?        Ss   18:44   0:00 php-fpm: master process (/etc/php-fpm.conf)
    nginx      19946  0.0  2.0 665936 16004 ?        S    18:44   0:00 php-fpm: pool www
    
  • Check your nginx config for allocation sizes to the fpm pools. Something else is going on here and I can't tell what it is without more info.

  • NeoonNeoon Community Contributor, Veteran
    edited February 2023

    Could be a memory leak and/or a plugin causing issues, who knows.

    Thanked by 3AuroraZero kdh arda
  • @Neoon said:
    Could be a memory leak and/or a plugin causing issues, who knows.

    I guess that would be a place to start at least. Disable plugins one by one and see if it helps.

  • Disable opcache too.

  • For WordPress, some suggestions:

    1. Check if the error.log file exists in the root of the WP installation
    2. Rename the Plugins folder (this will disable all plugins) to verify
    3. Change the theme and/or update to its latest version

    If there is a possibility and if necessary, both point 2 and 3 can be done on another hosting or server (a copy of the site)

  • jhjh Member

    Kindly install wordpress reduce memory plugin

  • You can check why a process consumes so much memory by running:

    sudo cat /proc/<pid>/maps
    
  • JustPfffJustPfff Member
    edited February 2023

    @Sauron said: cat /proc//maps

    Thanks, at last a comment that makes sense.

    https://pastebin.ubuntu.com/p/SDSR4qYvgK/plain/

  • I think JIT is bugged in PHP 8.2 as mine was also kept crashing, I had to switch back to 8.1.

    There were some JIT fixes merged to 8.2.2, not sure if it'll fix the issue.

    But I will wait for some more updates since the performance difference between 8.1 and 8.2 is negligible and I don't need its new functions.

Sign In or Register to comment.