Hello
It can be troubles with session, try to in the plugin settings page -> tab Options -> ‘Currency storage’ set Transient
+
remove session_start() from /path/to/site/wp-content/plugins/woocommerce-currency-switcher/classes/storage.php:25
Maybe session_start() leads to misconfiguration on the server because its done already on another place, its just an idea on the fly …
@realmag777
Thanks for answer!
I rechecked on my test installation (both default settings and ‘Currency storage: transient’, and woocommerce + currency switcher (latest versions) work fine, nothing related to switcher in php-slow.log
It seems, it’s an installation-specific problem, depending on other plugins installed.
For now I can’t trace the problem, but it’s doesn’t look like currency switcher’s fault anymore.
Once again thanks.
Fix for everyone who faced same or similar problem:
php-fpm should be configured to pool-per-site model. Example:
[global]
pid = run/php-fpm.pid
[SITE]
listen = /var/run/php-fpm.sock
listen.owner = www
listen.group = www
listen.mode = 0666
listen.backlog = -1
listen.allowed_clients = 127.0.0.1
user = www
group = www
pm = dynamic
#pm.max_children = 5
pm.max_children = 150
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max_requests = 1500
slowlog = /var/log/php-slow.log
request_slowlog_timeout = 5s
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
[OTHER_SITE]
listen = /var/run/php-fpm1.sock
listen.owner = www
listen.group = www
listen.mode = 0666
listen.backlog = -1
listen.allowed_clients = 127.0.0.1
user = www
group = www
pm = dynamic
#pm.max_children = 5
pm.max_children = 150
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max_requests = 1500
slowlog = /var/log/php-slow.log
request_slowlog_timeout = 5s
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
Somewhy only jailed installs are affected – out of jail same configs worked fine.
Ok. That’s embarrassing to speak about own stupid mistakes, but I have to update my previous answer, so that nobody would me misled.
Main source of WSODs and timeouts is misconfiguration of php-fpm limits:
pm.max_children – maximum php-fpm child processes, spawned for pool
pm.start_servers – amount of child processes at start up
pm.min_spare_servers – min idling childs
pm.max_spare_servers – max idling childs
pm.max_requests – requests, handled by child before restart
You should come up with amount of RAM that can be spared for php-fpm in general, then determine how much is consumed by single child (top will help here; empty process started with 25MB). Childs RAM usage grows while processing requests, so do not stick to minimum value. I suppose pm.max_requests value affects max size process can grow in RAM.
RAM utilization mentioned on forums, is about 45 MB per process; so if we want to give our php sites ~=1,8 GB RAM, it would be 40 processes.
An updated config for these conditions below:
[global]
pid = run/php-fpm.pid
[SITE]
listen = /var/run/php-fpm.sock
listen.owner = www
listen.group = www
listen.mode = 0666
listen.backlog = -1
listen.allowed_clients = 127.0.0.1
user = www
group = www
pm = dynamic
pm.max_children = 30
pm.start_servers = 20
pm.min_spare_servers = 10
pm.max_spare_servers = 30
pm.max_requests = 400
slowlog = /var/log/php-slow.log
request_slowlog_timeout = 5s
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
[OTHER SITE]
listen = /var/run/php-fpm1.sock
listen.owner = www
listen.group = www
listen.mode = 0666
listen.backlog = -1
listen.allowed_clients = 127.0.0.1
user = www
group = www
pm = dynamic
pm.max_children = 10
pm.start_servers = 10
pm.min_spare_servers = 5
pm.max_spare_servers = 10
pm.max_requests = 400
slowlog = /var/log/php-slow.log
request_slowlog_timeout = 5s
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
Hopefully, that’s it.
Hello John
Thank you for such detailed investigation 😉
@john.Borovski Why did you pick listen.mode 0666 for the pool instead of 0644?
I’ve also noticed this plugin slows down my website. It adds 4 seconds on to a page load.
@john.Borovski where do I change this code you mentioned.
@realmag777 is there anything you can do to improve the efficiency of your plugin? It’s causing us some major headaches.
thanks
@jtibbles
Hello
The plugin doesnt make any MySQL queries on the front, try to disable all plugin except woo+woocs and investigate it
+
Use this plugin: https://ww.wp.xz.cn/plugins/query-monitor/ to define which processes takes a lot of time (disable woocs – and try, enable woocs and try – then compare)