• Resolved mayank29gupta

    (@mayank29gupta)


    Hello,

    Recently admin section of my wordpress+woocommerce website hosted on cloudways slowed down a lot especially when creating or editing a product.

    I installed Query Monitor plugin and noticed that every time I create or edit a product, Really Simple SSL is sending multiple HTTP Api Calls which are adding to the load time.

    These requests are following

    1. rsssl_admin->get_test_page_contents()
    2. rsssl_admin->mixed_content_fixer_detected()
    3. rsssl_code_execution_allowed()
    4. rsssl_src_contains_wp_version()

    Out of these 3, mixed_Content_Fixer one usually takes around 3 seconds. While the 3rd one shows 403 Forbidden error.

    When I disabled Really Simple SSL on my staging website, the load time improved significantly. Is there any fix for this??

    • This topic was modified 1 year, 12 months ago by mayank29gupta.
Viewing 12 replies - 16 through 27 (of 27 total)
  • Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    If you load the latest (6.0.12.3), outside the SSL settings menu, on any other wp-admin page, you should see some logs which can tell us how it handles the caching on your site, and where the requests come from.

    I’ve also changed one condition for the caching. I’m curious what this does on your site!

    Lightweight SSL & Hardening Plugin Version 6.0.12.3

    Each time I click to a new admin page, I seem to get this series of log entries:

    php-errors.log ( ASCII text )
    [09-Dec-2022 09:24:07 UTC] plus one count transient: 
    [09-Dec-2022 09:24:07 UTC] get notices for the plus one count.
    [09-Dec-2022 09:24:07 UTC] cache admin notices 1
    [09-Dec-2022 09:24:07 UTC] this is a cached request => should be fast
    [09-Dec-2022 09:24:07 UTC] check wp version transient 
    [09-Dec-2022 09:24:12 UTC] plus one count transient: empty
    [09-Dec-2022 09:24:20 UTC] get notices list for the admin notice
    [09-Dec-2022 09:24:20 UTC] cache admin notices 1
    [09-Dec-2022 09:24:20 UTC] this is a cached request => should be fast
    [09-Dec-2022 09:24:20 UTC] check wp version transient no-response

    Along with QueryMonitor entries:

    cURL error 28: Operation timed out after 5001 milliseconds with 0 bytes received
    rsssl_src_contains_wp_version()
    wp-content/plugins/really-simple-ssl/security/tests.php:415
    rsssl_admin->validate_function()
    wp-content/plugins/really-simple-ssl/class-admin.php:2409
    rsssl_admin->get_notices_list()
    wp-content/plugins/really-simple-ssl/class-admin.php:2293
    rsssl_admin->count_plusones()
    wp-content/plugins/really-simple-ssl/class-admin.php:2448
    rsssl_add_option_menu()
    wp-content/plugins/really-simple-ssl/settings/settings.php:93
    do_action('admin_menu')
    wp-includes/plugin.php:517
    Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    It’s very strange. What PHP version are you on? I can see the cache works correctly, but the statement

    if ( !$result )
    evaluates to true even if the result contains a string. PHP normally evaluates

    if ( 'some-string' ) as true, and if ( !'some-string' ) as false.

    A mystery. I’ve changed this to

    if ( $response ===false )

    Which I expect to work on your server as well, because it should only evaluate to true if the response is a boolean false, not in any other case. The latest is now 6.0.12.4

    Hope this works!

    Hi Rogier Lankhorst (@rogierlankhorst)
    Thanks for working on this, and for your patience. ??
    Problem still persists. I wonder if I have misconfigured the server, as I used to use Cloudflare for this site, but there are no obvious signs of any errors.

    – PHP version: 7.4.33 (see below)
    – openSSL or CURL version: host cpanel shows no errors.
    – firewall blocking cURL: Wordfence not showing any issue; I put into ‘learning mode’ just in case.

    Lightweight SSL & Hardening Plugin Version 6.0.12.4 |

    You are running WordPress 6.1.1 | PHP 7.4.33 | LiteSpeed | MySQL 10.3.36-MariaDB-cll-lve
    Server architecture	Linux 3.10.0-962.3.2.lve1.5.73.el7.x86_64 x86_64
    Web server	LiteSpeed
    PHP version	7.4.33 (Supports 64bit values)
    PHP SAPI	litespeed
    PHP max input variables	1500
    PHP time limit	240
    PHP memory limit	512M
    Max input time	-1
    Upload max filesize	128M
    PHP post max size	128M
    cURL version	7.84.0 OpenSSL/1.1.1p
    Is SUHOSIN installed?	No
    Is the Imagick library available?	No
    Are pretty permalinks supported?	Yes
    .htaccess rules	Custom rules have been added to your .htaccess file.
    Dec 09, 20:26:33 cache admin notices 1
    Dec 09, 20:26:24 RUN WP VERSION TEST
    Dec 09, 20:26:24 check wp version transient
    Dec 09, 20:26:24 cache admin notices 1
    Dec 09, 20:26:21 RUN WP VERSION TEST
    Dec 09, 20:26:21 check wp version transient
    Dec 09, 20:26:21 cache admin notices 1
    cURL error 28: Operation timed out after 5001 milliseconds with 0 bytes received
    rsssl_src_contains_wp_version()
    wp-content/plugins/really-simple-ssl/security/tests.php:416
    rsssl_admin->validate_function()
    wp-content/plugins/really-simple-ssl/class-admin.php:2399
    rsssl_admin->get_notices_list()
    wp-content/plugins/really-simple-ssl/class-admin.php:2283
    rsssl_admin->count_plusones()
    wp-content/plugins/really-simple-ssl/class-admin.php:2436
    rsssl_add_option_menu()
    wp-content/plugins/really-simple-ssl/settings/settings.php:93
    do_action('admin_menu')
    wp-includes/plugin.php:517

    I don’t know if this HTTP REQUEST is related, but the duration is 5 secs >
    GET https://savemaldives.net http_request_failed

    Array
    (
        [url] => https://savemaldives.net
        [args] => Array
            (
                [method] => GET
                [timeout] => 5
                [redirection] => 3
                [httpversion] => 1.0
                [user-agent] => WordPress/6.1.1; https://savemaldives.net
                [reject_unsafe_urls] => 
                [blocking] => 1
                [headers] => Array
                    (
                    )
    
                [cookies] => Array
                    (
                    )
    
                [body] => 
                [compress] => 
                [decompress] => 1
                [sslverify] => 1
                [sslcertificates] => /home/photomal/public_html/SaveMaldives/main/wp-includes/certificates/ca-bundle.crt
                [stream] => 
                [filename] => 
                [limit_response_size] => 
                [time_start] => 1670598706.0821
                [_qm_key] => 1670598706.0821https://savemaldives.net
                [_redirection] => 3
                [time_stop] => 1670598711.0855
                [duration] => 5003.4019947052
            )
    
        [r] => WP_Error Object
            (
                [errors] => Array
                    (
                        [http_request_failed] => Array
                            (
                                [0] => cURL error 28: Operation timed out after 5001 milliseconds with 0 bytes received
                            )
    
                    )
    
                [error_data] => Array
                    (
                    )
    
                [additional_data:protected] => Array
                    (
                    )
    
            )
    
        [class] => Requests
        [stack_trace] => Array
            (
                [0] => Debug_Bar_WP_Http->after_http_request
                [1] => WP_Hook->apply_filters
                [2] => WP_Hook->do_action
                [3] => do_action('http_api_debug')
                [4] => WP_Http->request
                [5] => WP_Http->get
                [6] => wp_remote_get
                [7] => rsssl_src_contains_wp_version
                [8] => rsssl_admin->validate_function
                [9] => rsssl_admin->get_notices_list
                [10] => rsssl_admin->count_plusones
                [11] => rsssl_add_option_menu
                [12] => WP_Hook->apply_filters
                [13] => WP_Hook->do_action
                [14] => do_action('admin_menu')
                [15] => require_once('wp-admin/includes/menu.php')
                [16] => require('wp-admin/menu.php')
                [17] => require_once('wp-admin/admin.php')
            )
    
    )

    Comparing speed of WP-Admin >

    Page Generation Time = 13.3s
    Peak Memory Usage = 104.0 MB (20% of WP and server limits of 512MB)
    
    Database Queries = 0.1749s
    SELECT: 169
    SHOW: 2
    UPDATE: 1
    Total: 172
    
    HTTP API Calls
    12.7716s
    Total: 15
    
    Object Cache - Persistent object cache plugin in use
    Opcode cache - Opcode cache in use: Zend OPcache

    To front end (blog page) = perfectly OK

    Page Generation Time = 3.8s
    Peak Memory Usage = 95.3 MB
    Database Queries = 0.1978s
    SELECT: 190
    SHOW: 2
    UPDATE: 1
    Total: 193
    
    HTTP API Calls = 3.0863s
    Total: 5
    
    Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    @photomaldives I’ve changed tactics: I dropped the transient, and used an option now. Can you try what happens now? The first request has to be cached again, but after that it should be persistent.

    Hope this works!

    You just caught me ! I was signing off as it’s almost midnight here.

    Same # ? Version 6.0.12.4

    Hey … I think you’ve cracked it! Clicking around WP Admin, about 10 different pages now – each page still loads too slowly, but they are now consistently below 10secs, and the 5 sec timeout has gone !

    
    Dec 09, 23:25:39 cache admin notices 1
    Dec 09, 23:25:30 check wp version transient no-response
    Dec 09, 23:25:29 cache admin notices 1
    Dec 09, 23:25:01 cache admin notices 1
    Dec 09, 23:24:54 check wp version transient no-response
    Dec 09, 23:24:54 cache admin notices 1
    Dec 09, 23:24:45 cache admin notices 1
    
    Plugin: really-simple-ssl
    rsssl_admin->get_test_page_contents() 0.2 kB	5	0.2826
    rsssl_code_execution_allowed()        0.7 kB	5	0.0121 = 403 Forbidden	
    Total: 2 / 14	0.2947
    Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    @photomaldives that’s good to hear, we’re getting there I think.

    I suspect that the object cache you use, the Redis cache, is somehow interfering with the functionality of the transient caching. Looking at your logs, it looks like the transients don’t store the data properly, resulting in continuous checks.

    I’ve decided to move some of these transients to more persistent options, then clear these with a cron schedule, which has the same effect, but doesn’t have the risk of issues with object caching.

    I think if you load the latest branch (version 6.0.12.5), you will see an improvement, as the notices will be cached in a more persistent way for your setup.

    We’ll be testing this, I expect it to get merged in the next release, in one or two weeks.

    Let me know what your results are with the last version!

    Redis object cache – I’ve never heard of that, and haven’t knowingly enabled it. Checking my LiteSpeed settings:
    OBJECT CACHE SETTINGS - Object Cache Type = Memcached Server
    So if Redis is enabled in addition, seems that will cause issues. I don’t know how or where to disable it.

    Oh, and I updated to PHP 8.1.13 now. ??

    Lightweight SSL & Hardening Plugin Version 6.0.12.5
    PHP errlog:

    Dec 10, 20:08:29
    Warning: foreach() argument must be of type array|object, string given in .../really-simple-ssl/class-admin.php on line 1669

    LiteSpeed settings – there are lots! I’ve simply turned everything on with defaults, as far as I remember.
    https://docs.litespeedtech.com/lscache/lscwp/cache/#object-cache

    At least my SSL is looking good! A+ ??

    Status Powered by Qualys
    No TLS 1.1
    HSTS header detected
    Valid certificate
    Cipher strength 90%
    
    • This reply was modified 1 year, 11 months ago by photoMaldives.
    Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    @photomaldives I’ve als wrapped the php 8 notice you posted, so should all be good now, even with Redis cache ??

    This branch will go into the test queue, I expect it to be released in two weeks.

    I can confirm that my dashboard remains faster and error-free. ??

    Thanks for sticking with it, Rogier @rogierlankhorst and thanks for all you do for the WP community. ??

Viewing 12 replies - 16 through 27 (of 27 total)
  • The topic ‘Regarding HTTP API Calls by Plugin’ is closed to new replies.