Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #34832
    Mike
    Guest

    I have premium W3TC license and have elastic cache autodiscovery client installed.

    In object/database cache settings I have entered the configuration endpoint and ticked box for auto discovery. If I click the test button it gives me a green pass tick.

    Now if I view the source code of a page I get the following:

    <!--
    Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/
    
    Object Caching 0/2911 objects using memcached
    
    Object Cache debug info:
    Caching:            enabled
    Total calls:        2911
    Cache hits:         0
    Total time:         0.1564
    Content Delivery Network via Amazon Web Services: S3: mvpproshop-media.s3.amazonaws.com
    Database Caching using memcached (Request-wide User is logged in)
    
    Db cache debug info:
    %2
    %2
    %2$.4f
    
    Served from: localhost @ 2021-03-10 09:39:10 by W3 Total Cache
    -->
    Notice: Undefined variable: s in /wpfiles/htdocs/wp-content/plugins/w3-total-cache/DbCache_WpdbInjection_QueryCaching.php on line 748
    
    Notice: Undefined variable: d in /wpfiles/htdocs/wp-content/plugins/w3-total-cache/DbCache_WpdbInjection_QueryCaching.php on line 748
    
    Notice: Undefined variable: s in /wpfiles/htdocs/wp-content/plugins/w3-total-cache/DbCache_WpdbInjection_QueryCaching.php on line 749
    
    Notice: Undefined variable: d in /wpfiles/htdocs/wp-content/plugins/w3-total-cache/DbCache_WpdbInjection_QueryCaching.php on line 749
    
    Notice: Undefined variable: s in /wpfiles/htdocs/wp-content/plugins/w3-total-cache/DbCache_WpdbInjection_QueryCaching.php on line 750

    If I specify the node endpoint directly then it works but I need the autodiscovery to work as we have a cache cluster and adjust the number of nodes.

    Why is it not working?

    #34863

    Hello Mike,

    Thank you for your inquiry and I am happy to assist you with this.

    There is a possible issue in /wp-content/plugins/w3-total-cache/DbCache_WpdbInjection_QueryCaching.php lines 742-744.
    Change the double-quotes to single:

    $strings[] = sprintf( "%s%d", str_pad( 'Total queries: ', 20 ), $this->query_total );
    $strings[] = sprintf( "%s%d", str_pad( 'Cached queries: ', 20 ), $this->query_hits );
    $strings[] = sprintf( "%s%.4f", str_pad( 'Total query time: ', 20 ), $this->time_total
    );

    to

    $strings[] = sprintf( '%s%d', str_pad( 'Total queries: ', 20 ), $this->query_total );
    $strings[] = sprintf( '%s%d', str_pad( 'Cached queries: ', 20 ), $this->query_hits );
    $strings[] = sprintf( '%s%.4f', str_pad( 'Total query time: ', 20 ), $this->time_total );

     

    Try this out and let me know if this helps!

    Thanks!

    #34869
    Mike
    Guest

    Hi Marko,

    Thanks for the reply. Adding the ‘ removed the notice but the issue still remains,

    With normal php memcached client I am able to hit nodes directly and it will cache objects./

    With aws discovery client using configuration endpoint it always has 0 cache hits but no actual errors.

    #34893

    Hello Mike,

    Thank you for the information.

    Does this always happen when logged in or have you checked when logged out from the wp-admin?

    Thanks!

    #34896
    Mike
    Guest

    I have checked in incognito mode and it is missing cache. Switching back to regular memcached client I can see the hits testing same way.

    #34929

    Hello Mike.

    Looking at your website I see

    Object Caching 419/23626 objects using Memcached
    Page Caching using Memcached 
    Content Delivery Network via Amazon Web Services: S3: mvpproshop-media.s3.amazonaws.com
    Database Caching 2/4883 queries in 14.265 seconds using Memcached (Request-wide modification query)
    Served from: localhost @ 2021-03-12 10:06:23 by W3 Total Cache

    Have you switched to a regular Memcached client and not autodiscovery?
    If you check this article you need to Install the Memcached Client
    That requires a PHP module amazon-elasticache-cluster-client.so
    https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/AutoDiscovery.HowAutoDiscoveryWorks.html
    There are the module for:
    https://elasticache-downloads.s3.amazonaws.com/ClusterClient/PHP-7.3/latest-64bit
    https://elasticache-downloads.s3.amazonaws.com/ClusterClient/PHP-7.2/latest-64bit
    https://elasticache-downloads.s3.amazonaws.com/ClusterClient/PHP-7.0/latest-64bit
    https://elasticache-downloads.s3.amazonaws.com/ClusterClient/PHP-5.6/latest-64bit
    https://elasticache-downloads.s3.amazonaws.com/ClusterClient/PHP-5.5/latest-64bit
    https://elasticache-downloads.s3.amazonaws.com/ClusterClient/PHP-5.4/latest-64bit
    https://elasticache-downloads.s3.amazonaws.com/ClusterClient/PHP-5.3/latest-64bit
    5:15
    No 7.4 or 8.0 yet. No 7.1.

    Thanks!

    #34932
    Mike
    Guest

    Yes, the production site is using regular memcached client.

    I had created a separate environment in AWS for testing and I did downloaded and installed the aws autodiscovery client. This is what I have been discussing. I am pretty sure I have followed all correct procedure for installing it.

    The regular PHP memcached client works fine, I haven’t had any issues with this.

    AWS autodiscovery client always has 0 cache hits. Your code recognises the autodiscovery client as it allows me to select the autodiscovery checkbox. The test button gives a passing test when I add the configuration endpoint in as address.

    There is always 0 cache hits with the AWS autodiscovery client. I have no problems with the regular memcached client.

    #34933
    Mike
    Guest

    Sorry, I am just re-reading what you wrote. There is a 7.4 client, it is what I am using but AWS don’t make the link public anymore. To get it you have to go to ElastiCache in AWS and in left menu last option there is a link to download it.

    I can email/upload this to you if it helps.

    #34969
    Mike
    Guest

    I have realised that with the regular memcached client I am also not getting many hits. It makes ~1600 calls over 10 seconds and gets ~5 hits.

    I have contacted AWS and they say they can’t see anything wrong with ElastiCache. I tried upgrading to 16 core elasticache instance but it didn’t make any difference.

    I think maybe the issue is with all network memcached calls?

    I tried running exact same site with local memcached installed and it get 100% cache hits.

    #34989
    Mike
    Guest

    One think I have noticed. If I put exact same site & code locally or on a server with memcached installed locally it will say something like 690/700 object cache hits. When having it on AWS with ElastiCache it will say something like 10/3900 cache hits. Also when memcached on same server it completes in a fraction of a second. With ElastiCache it take 10+ seconds.

    AWS are insisting there isn’t anything wrong with ElastiCache but something is obviously wrong.

    The site works way better without any cache. As soon as I enable cache the site slows down to a crawl and it can’t handle as much load.

    Unfortunately using a single server with memcached locally is not an option for me as during promotions we need to scale up to multiple servers.

    Any idea what is wrong?

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘AWS Autodiscovery not working’ is closed to new replies.