Support » Plugin: Ajax Search for WooCommerce » BUG OVERLOAD SERVER

  • Resolved code222

    (@code222)


    hi, in last month i see some time my VPS where host my website shutdown the mysql server, so i tried to found the cause, i found that plugin cause this.

    When a user start to insert a long phrase in search box i see the CPU go to high and create infinite php request.

    Example when i tried to write manually in search box this phrase “my names is jhon doe and i am american”

    the server start to create infinite www-data request like below:

    =========
    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    1309 mysql 20 0 1027520 176500 17856 S 67.4 8.8 0:24.97 mysqld
    1878 www-data 20 0 450548 76096 52516 S 3.7 3.8 0:01.02 php-fpm5.6
    1884 www-data 20 0 450548 76352 52516 S 1.0 3.8 0:01.14 php-fpm5.6
    1886 www-data 20 0 462800 89644 53820 S 1.0 4.5 0:01.67 php-fpm5.6
    1900 www-data 20 0 450512 76328 52528 S 1.0 3.8 0:01.04 php-fpm5.6
    1906 www-data 20 0 450512 76332 52532 S 1.0 3.8 0:01.05 php-fpm5.6
    1923 www-data 20 0 450256 76068 52532 S 1.0 3.8 0:00.38 php-fpm5.6
    1925 www-data 20 0 450292 76104 52532 S 1.0 3.8 0:00.35 php-fpm5.6
    1931 www-data 20 0 450292 76108 52536 S 1.0 3.8 0:00.34 php-fpm5.6
    1932 www-data 20 0 450304 76124 52536 S 1.0 3.8 0:00.35 php-fpm5.6
    1898 www-data 20 0 450512 76324 52524 S 0.7 3.8 0:01.04 php-fpm5.6
    1901 www-data 20 0 450512 76328 52528 S 0.7 3.8 0:01.03 php-fpm5.6
    1922 www-data 20 0 450292 76104 52532 S 0.7 3.8 0:00.35 php-fpm5.6
    1924 www-data 20 0 450292 76104 52532 S 0.7 3.8 0:00.36 php-fpm5.6
    1927 www-data 20 0 450292 76104 52532 S 0.7 3.8 0:00.34 php-fpm5.6
    1928 www-data 20 0 450292 76104 52532 S 0.7 3.8 0:00.34 php-fpm5.6
    1 root 20 0 119968 6052 4008 S 0.3 0.3 0:02.97 systemd
    1612 root 20 0 41816 3736 3124 R 0.3 0.2 0:01.39 top
    2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
    3 root 20 0 0 0 0 S 0.0 0.0 0:00.06 ksoftirqd/0
    5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H
    6 root 20 0 0 0 0 S 0.0 0.0 0:00.06 kworker/u2:0
    7 root 20 0 0 0 0 S 0.0 0.0 0:00.26 rcu_sched
    8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh
    9 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
    10 root rt 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
    11 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kdevtmpfs
    12 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 netns
    13 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 perf
    14 root 20 0 0 0 0 S 0.0 0.0 0:00.00 khungtaskd
    15 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 writeback
    16 root 25 5 0 0 0 S 0.0 0.0 0:00.00 ksmd
    17 root 39 19 0 0 0 S 0.0 0.0 0:00.00 khugepaged
    18 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 crypto
    19 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kintegrityd
    20 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 bioset
    21 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kblockd

    =========

    I think require a better optimization, can you check if you see this problem on your environment ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Damian Gora

    (@damian-gora)

    Hi,
    You are 100% right. I think the other users can have a similar problem, so I decided to fix it quickly.

    I added something like _.debounce from lodash. It should fix your issue.
    Currently after type “my names is jhon doe and i am american” you have about 38 AJAX requests. After my improvements, you will have max few requests or one if you type this phrase fast enough.

    The patch will be added in the next plugin release. If you want to test it, I can send you a package. I have finished it and this feature is on the testing stage. You can contact me by email.

    Best
    Damian Góra

    Thanks for faster solution and reply, if require more 1 week to release the next update i prefer to send me the package now, otherwise i will wait..

    Where i can download the package ? are necessary a request by email to receive the package updated ?

    Plugin Author Damian Gora

    (@damian-gora)

    I added changes to the development version of the plugin. To download it, go to https://wordpress.org/plugins/ajax-search-for-woocommerce/advanced/ and scroll down to the section “PREVIOUS VERSIONS”. Download “Development version”.

    It’s still the beta version, so be careful and make backup if you want to test it on the live website.

    Best
    Damian Góra

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