Want to subscribe to topics you're interested in?
Become a Member

Problem memcached and long urls

Discussion in 'Other Centmin Mod Installed software' started by Inforit, Oct 16, 2014.

  1. Inforit

    Inforit Premium Member Premium Member

    52
    15
    8
    Jul 30, 2014
    Ratings:
    +22
    Local Time:
    8:20 PM
    nginx/1.7.3
    MariaDB 5.5
    Hi,
    I am using wordpress with memcached and install settings and getting lots of 502 erros with Russian urls, think it is because they go over 220 characters in url.
    Is there any quick way to fix it? I have been reading this can be solved with enhanced memcached module or HttpSRCacheModule

    Thanks

     
  2. eva2000

    eva2000 Administrator Staff Member

    53,488
    12,130
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,671
    Local Time:
    5:20 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  3. Inforit

    Inforit Premium Member Premium Member

    52
    15
    8
    Jul 30, 2014
    Ratings:
    +22
    Local Time:
    8:20 PM
    nginx/1.7.3
    MariaDB 5.5
    Thanks eva2000
    I will check and see if I can find anything doesn't look that much of a common problem unfortunately ;)
     
  4. eva2000

    eva2000 Administrator Staff Member

    53,488
    12,130
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,671
    Local Time:
    5:20 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Ah found the Google+ Community post related to this here

    quoting my own post replies :)
    Didn't get any further feedback if that worked or not, so you can try it and see. Of course that was with memcache 3.0.7 PHP extension, nowadays Centmin Mod is using memcache 3.0.8 PHP extension and libmemcached 1.0.18 and memcached 1.4.20 server
     
  5. eva2000

    eva2000 Administrator Staff Member

    53,488
    12,130
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,671
    Local Time:
    5:20 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    ah i see you refer to enhanced memcached module but it lists only been tested with Nginx up to 1.4 bpaquet/ngx_http_enhanced_memcached_module · GitHub ?

    and uses hashing to work around 250 limit
    But does Wordpress and wordpress plugins support enhanced_memcached module or even use it at Nginx level ? As Wordpress might use it from PHP > memcache/memcached PHP extension level only so Nginx enhanced memcached module wouldn't be of any use?
     
  6. Inforit

    Inforit Premium Member Premium Member

    52
    15
    8
    Jul 30, 2014
    Ratings:
    +22
    Local Time:
    8:20 PM
    nginx/1.7.3
    MariaDB 5.5
    Thats a good point, I have no idea if they do support.
    I will try changing the keys first see if that works, and go from there.

    Cheers
     
  7. Inforit

    Inforit Premium Member Premium Member

    52
    15
    8
    Jul 30, 2014
    Ratings:
    +22
    Local Time:
    8:20 PM
    nginx/1.7.3
    MariaDB 5.5
    I changed those setting still getting lots of error messages like this one, all over 250 characters in length, how can I be sure it is the length not something else?

    Thanks


    error log looks like:

    Code:
    memcached sent invalid response: "CLIENT_ERROR bad command line format" while reading response header from upstream, client: , server: , request: "GET /ru/%20property%20/%25d0%25b2%25d0%25b8%25d0%25bb%25d0%25bb%25d0%25b0-%25d1%2580%25d0%25b0%25d0%25b7%25d0%25b4%25d0%25b5%25d0%25bb%25d0%25b5%25d0%25bd%25d0%25bd%25d0%25b0%25d1%258f-%25d0%25bd%25d0%25b0-2-%25d0%25b4%25d0%25be%25d0%25bc%25d0%25b0-%25d0%25b2-a%25d0%25bb%25d1%258c%25d1%2582%25d0%25b5%25d0%25b0/
     
  8. eva2000

    eva2000 Administrator Staff Member

    53,488
    12,130
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,671
    Local Time:
    5:20 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Did you run centmin.sh menu option 10 to recompile memcached server and the PHP extensions for memcache and memcached/libmemcached after editing the limits ? If you did, then guess it didn't work, seems your requests are 310 characters long > 250 character limit

    that is definitely the 250 chars limit of memcached causing it as it tries this message from the source code
    Code:
    memcached.c:    if (tokens[KEY_TOKEN].length > KEY_MAX_LENGTH) {
    memcached.c-        out_string(c, "CLIENT_ERROR bad command line format");
    memcached.c-        return;
    memcached.c-    }
    
    memcached.h:#define KEY_MAX_LENGTH 250
    memcached.h-
     
  9. eva2000

    eva2000 Administrator Staff Member

    53,488
    12,130
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,671
    Local Time:
    5:20 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  10. Inforit

    Inforit Premium Member Premium Member

    52
    15
    8
    Jul 30, 2014
    Ratings:
    +22
    Local Time:
    8:20 PM
    nginx/1.7.3
    MariaDB 5.5
    After centmin install I followed your guide for wordpress with WP-FFPC + ngx_pagespeed, great difference in speed! just
    a bugger with the russian language.

    I searched for all files with those variables in /svr-setup and changed to 350 then run option 10 of centmin.sh

    Not really sure at what level I am using memcached sorry..

    Here is the vhost conf

    Thanks

    Code:
    
    
    # redirect from non-www to www
    # uncomment, save file and restart Nginx to enable
    #server {
    #            listen   80;
    #            server_name .com;
    #            return 301 $scheme://www..com$request_uri;
    #       }
    
    server {
      server_name .com www..com;
    
    # ngx_pagespeed & ngx_pagespeed handler
    include /usr/local/nginx/conf/pagespeed.conf;
    include /usr/local/nginx/conf/pagespeedhandler.conf;
    include /usr/local/nginx/conf/pagespeedstatslog.conf;
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/.com/log/access.log combined buffer=32k;
      error_log /home/nginx/domains/.com/log/error.log;
    
      root /home/nginx/domains/.com/public;
    
    include /usr/local/nginx/conf/wpsecure.conf;
    include /usr/local/nginx/conf/wpnocache.conf;
    
    
    
    location /nginx-status {
        stub_status on;
        access_log   off;
        allow removed ips;
        allow 127.0.0.1;
        allow removed ips;
        allow removed ips;
        deny all;
            }
    
      location / {
    
    #try_files $uri $uri/ /wordpress/index.php?q=$request_uri;
    
    
    # block common exploits, sql injections etc
    #include /usr/local/nginx/conf/block.conf;
    
      # Enables directory listings when index file not found
      #autoindex  on;
    
    try_files $uri $uri/ @memcached;
    
      # Shows file listing times as local time
      #autoindex_localtime on;
    
      # Enable for vBulletin usage WITHOUT vbSEO installed
      #try_files    $uri $uri/ /index.php;
    
      }
    
    include /usr/local/nginx/conf/wpffpc.conf;
      include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/php.conf;
      include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
    }
     
  11. eva2000

    eva2000 Administrator Staff Member

    53,488
    12,130
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,671
    Local Time:
    5:20 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    yeah with WP-FFPC memcached is used at Nginx level.. best to switch over to Super Cache instead of WP-FFPC for that Russian site then so you use Nginx's static file caching which won't have such limitations as Memcached and in fact WP Super Cache faster than WP-FFPC caching ;)
     
  12. Inforit

    Inforit Premium Member Premium Member

    52
    15
    8
    Jul 30, 2014
    Ratings:
    +22
    Local Time:
    8:20 PM
    nginx/1.7.3
    MariaDB 5.5
    Thanks @eva2000 I'll give that a try
     
  13. Inforit

    Inforit Premium Member Premium Member

    52
    15
    8
    Jul 30, 2014
    Ratings:
    +22
    Local Time:
    8:20 PM
    nginx/1.7.3
    MariaDB 5.5
    Working fine, speed seems faster than with memcached too :)

    thanks
     
  14. eva2000

    eva2000 Administrator Staff Member

    53,488
    12,130
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,671
    Local Time:
    5:20 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    excellent to hear :D
     
  15. jeffwidman

    jeffwidman Active Member

    152
    27
    28
    Dec 3, 2014
    Ratings:
    +51
    Local Time:
    12:20 PM
    FYI as of 1.8.0 release of WP-FFPC, you can now store the keys as SHA1 hashes rather than the full url--it was added specifically to deal with this issue. You'll need a version on Nginx that supports Sha1 (see the plugin FAQ for details)
     
  16. eva2000

    eva2000 Administrator Staff Member

    53,488
    12,130
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,671
    Local Time:
    5:20 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    nice to know indeed looks like it's the case WordPress › Support » memcache cache key length luckily Centmin Mod .08 beta of Nginx includes set-misc nginx module Beta Branch - Openresty echo-nginx-module, set-misc-nginx-module & ngx_devel_kit added to .08 beta | Centmin Mod Community :)