• Resolved astahov006

    (@astahov006)


    Hello!

    I used cache info plugin with nginx+apache on my sites initially and it gave me useful details. So I increased WP memory limit to 68M or 128M, OPcache memory consumption to 128M or 256M, installed memcached. And everything was clear for me.

    But then I switched my sites to nginx+php-fpm configuration because apache was slow and real bottleneck.

    Now in cache info plugin I see WP memory usage double to 256M and more, OPcache usage is always 100% with hitrate no more than 15%. I increased OPcache memory consumption to 512M (that was not enough), then to 1024M, then to 2048M but nothing changed. OPcache usage is always 100% with hitrate 10 -15% no more. And I see that memcached and OPcache details (items, hits, misses) in plugin are common on all the sites so as they use one common shared cache memory buffer.

    Seems strange to me but maybe that’s all right.

    The question is if I have 10 sites on my VDS and when on apache they used near 150M opcache each with hitrate near 90%, should I now increase OPcache memory consumption to 20000M to see opcache usage less than 100% and hitrate 80% or more?

    Regards, Alex

    • This topic was modified 3 days, 14 hours ago by astahov006.
Viewing 15 replies - 1 through 15 (of 50 total)
  • Plugin Author docjojo

    (@docjojo)

    Hello Alex,

    OPcache and memcached are totally different types of cache.
    They are not related. memcached is a persistent object-cache and will only work in WP if you are using a plugin.

    The OC memory usage should be equal across multisites at a given point in time, as they share the same memory, the hitrate is relative to the site though.
    I have 10 sites on a machine with 256MB, usage is around 40%, hitrate 60% and more.
    If your usage is 100% with large memory size –?there is likely something wrong with your config.

    Your question: No, makes no sense to increase beyong 2GB, even 1GB probably. Only heave sites need large memory, when using woo for example.

    Did you stop apache or is it still running?
    You will probably have to tweak around with the php-fpm settings.
    Also, what is the server memory size?
    It might also help to reboot the machine – just to make sure nothing else is influencing the situation.


    Thread Starter astahov006

    (@astahov006)

    Hello, docjojo

    Situation with memcached is clear enough. Usage near 50%, hitrate near 80%. That’s all right.

    But OPcache with 2GB memory consumption and 100% usage with 15% hitrate doesn’t seem normal.

    Apache is still running on my VDS. But my WP sites don’t use it anymore. They are heavy enough with woocommerce and also portal type with many plugins installed.

    Regards, Alex

    Plugin Author docjojo

    (@docjojo)

    What PHP version?
    Stop apache if you don’t need it.

    Thread Starter astahov006

    (@astahov006)

    php v8.3

    VDS memory 8G. 3G in use.

    I didn’t stop apache cause it still used for redirects to other sites with .htaccess.

    Plugin Author docjojo

    (@docjojo)

    you can try to increase opcache.interned_strings_buffer which could take some load of the OC memory.

    also run HTOP on your machine and look for php-fpm processes.
    maybe you have to decrease pm.max_requests if there are too many.

    but the high memory usage is an indicator for a script issue.
    you could use atec-profiler or query monitor to find scripts that take a long time to execute or use much memory.
    than temp. disabled the according plugin and see if that changes anything.

    also make sure your system is up to date (apt update, upgrade)

    In case you want to work on PHP, have a look at for PHP-FPM tuning.

    https://mateusguimaraes.com/posts/optimizing-php-applications-for-performance

    Thread Starter astahov006

    (@astahov006)

    Ok. Thanks. I stoped apache.

    If your plugin displays the correct values for OPcache than I see that all my sites use one common cache because the number of items and hitrate are the same for all the sites and don’t depend on memory consumption setting.

    Plugin Author docjojo

    (@docjojo)

    Do you still face high mem usage?

    What is your opcache.max_accelerated_files setting?

    Thread Starter astahov006

    (@astahov006)

    Max. files 100 000

    https://infosecshop.ru/wp-content/uploads/2024/11/snapshot_2024-11-19_15-02-18.png

    Today hitrate 40%, Items:7,457 for all sites

    If this is common shared memory I don’t know is it too much for 9 sites.

    Plugin Author docjojo

    (@docjojo)

    The values shown by the plugin are correct.
    Yes, it is a shared memory. You can tell by OPC Scripts tab in atec-cache-info PRO.
    This will list all the cached scripts and their full path so you can see that these belong to different sites on the same machine.

    Thread Starter astahov006

    (@astahov006)

    In this case how can I give more shared memory for OPcache to my sites to increase hitrate? Should I increase memory consumption value on all the sites say to 2G, for example?

    Thread Starter astahov006

    (@astahov006)

    And I don’t understand. If OPcache takes more than 2G and all memory usage on VDS is less than 3G. In this case system, cms, 9 sites and all plugins have to take take at least less than 1G?

    Plugin Author docjojo

    (@docjojo)

    I have just uploaded a new version, please update.
    Details OPC info.

    The OPC Scripts tab will show all cached scripts and that can give you more insights to why hitrate is low.

    What do you mean by “memory consumption value on all the sites” – it’s a shared memory so you set the consumption once in your php.ini and this value is valid for all the sites on your machine.

    Plugin Author docjojo

    (@docjojo)

    Please update and send a screenshot.

    Thread Starter astahov006

    (@astahov006)

    Here it is for two sites:

    https://infosecshop.ru/wp-content/uploads/2024/11/snimok-ekrana_2024-11-21_16-20-28.png

    https://infosecshop.ru/wp-content/uploads/2024/11/snimok-ekrana_2024-11-21_16-19-28.png

    I have different php params for every site. You can see on snapshots opcache.memory_consumption 1G and 2G.

    And by the way, if I turn on JIT, woocommerce sites stop working properly.

    Plugin Author docjojo

    (@docjojo)

    JIT can improve, but also cause issues.
    I recommend JIT but it must be tested against installed plugins.
    Some of them crash, such as Woo.

Viewing 15 replies - 1 through 15 (of 50 total)
  • You must be logged in to reply to this topic.