Code Monkey home page Code Monkey logo

Comments (8)

vozlt avatar vozlt commented on May 17, 2024

Please let me know nginx configuration and version to reproduce the situation.

from nginx-module-vts.

EricByers avatar EricByers commented on May 17, 2024

Currently we're seeing it on 1.9.4, 1.9.6 and 1.9.7, but I believe we were seeing it on previous versions as well (although it seems to come and go).

Our configuration is a bit complex, here is the current setup:

./configure --user=nginx --group=nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf \
    --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid \
    --add-module=/root/nginx-tmp/lua-nginx-module-0.9.16 --with-select_module --with-poll_module --with-file-aio \
    --with-http_ssl_module --with-http_spdy_module --with-http_realip_module --with-http_addition_module \
    --with-http_image_filter_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module \
    --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module \
    --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module \
    --with-http_degradation_module --with-http_stub_status_module --with-http_perl_module --with-mail \
    --with-mail_ssl_module --with-cpp_test_module  --with-cpu-opt=CPU --with-pcre  --with-pcre-jit  --with-md5-asm  \
    --with-sha1-asm  --with-zlib-asm=CPU --with-libatomic --with-debug --with-ld-opt="-Wl,-E,-rpath,/usr/local/lib" \
    --add-module=/root/nginx-tmp/ngx_devel_kit-0.2.19/ --add-module=/root/nginx-tmp/nginx-rtmp-module-1.1.7/ \
    --add-module=/root/nginx-tmp/form-input-nginx-module-0.11/ --add-module=/root/nginx-tmp/nginx-module-vts-0.1.2/ \
    --add-module=/root/nginx-tmp/graphite-nginx-module-1.0.4 --add-module=/root/nginx-tmp/headers-more-nginx-module-0.26/

from nginx-module-vts.

vozlt avatar vozlt commented on May 17, 2024

Sorry, Please let me know nginx.conf :)

from nginx-module-vts.

EricByers avatar EricByers commented on May 17, 2024

Ha, whoops, here's what we have (this is just the relevant snippets). I removed some of the graphite data, but left a lot of the other data there.

Looking at this again, it appears maybe it's an issue with the cache name being a variable (nginx seems to handle this correctly internally from our testing -- i.e. the correct cache gets used).

proxy_cache_path /var/lib/nginx/cache/search keys_zone=search:1000m max_size=10g inactive=30d loader_files=1000 levels=1:2;
proxy_cache_path /var/lib/nginx/cache/search_live keys_zone=search_live:1000m max_size=10g inactive=1d loader_files=1000 levels=1:2;

location ^~ /search/ {
        set $cache_name 'search_live';

        access_by_lua '
            ngx.req.read_body();
            local request_body = json.decode(ngx.req.get_body_data());

            if (request_body.sourceId and request_body.sourceId ~= "live") then
                ngx.var.cache_name = "search"
            end
        ';

         # Removed some graphite module sends here.

        proxy_pass http://search_service/search/;

        # Enable caching, set the cache zone.
        # We use separate cache blocks here in order to easily dump just the live (dashboard ones).
        proxy_cache $cache_name;

        # Build the cache based on headers, request, and host.
        proxy_cache_key "search--$host$request_uri--$request_body";

        proxy_cache_bypass $bypass_cache;
        proxy_no_cache $no_cache;

        # Only cache POSTS that are 200
        proxy_cache_methods POST;

        # We default to no cache here, X-Accel-Expires will be passed back by the search server
        # overriding this.
        proxy_cache_valid 200 5d;
        proxy_cache_valid any 0m;

        # Use the cache if the cache is currently being updated (prevent dogpile)
        # or if the server returns 5XX (better stale than broken).
        proxy_cache_use_stale updating http_500 http_502 http_503 http_504;
        proxy_cache_lock on;
        proxy_cache_lock_timeout 5m;
        proxy_cache_lock_age 1m;
        add_header X-Cached $upstream_cache_status;
    }

from nginx-module-vts.

vozlt avatar vozlt commented on May 17, 2024

Thanks for the report.
I have confirmed that issue and it sloved in the new version which will commit soon.
I will commit fixed code soon.

from nginx-module-vts.

EricByers avatar EricByers commented on May 17, 2024

Awesome, thank you very much!

from nginx-module-vts.

vozlt avatar vozlt commented on May 17, 2024

I have a commit now.
Please check it whether it solved.
It need deeper and many review by peoples because of it changed many routine. :)

latest commit: e12984d

from nginx-module-vts.

EricByers avatar EricByers commented on May 17, 2024

Just loaded it up on our development machines, so far it looks like the caches are reporting correctly now, will let you know if we run into any issues. Thanks again.

from nginx-module-vts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.