Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redis set_keepalive doesn't work #268

Open
ebony0319 opened this issue Aug 31, 2023 · 1 comment
Open

redis set_keepalive doesn't work #268

ebony0319 opened this issue Aug 31, 2023 · 1 comment

Comments

@ebony0319
Copy link

I am writing a test to test the performance of reids. The following is my test code.
I used 2000 threads to test,and listen to the tcp connection of redis.
That connection pool doesn't seem to work very well, is it my code problem?

http {
    server {
        listen 80;

        location /redis {
            content_by_lua_block {
                local resty_redis = require "resty.redis"
                local redis = resty_redis:new()

                local ok, err = redis:connect("127.0.0.1", 6379)
                if not ok then
                    ngx.say("Failed to connect to Redis: ", err)
                    return
                end

                local res, err = redis:auth("r-xxxxx")
                if not res then
                    ngx.say("Failed to authenticate with Redis: ", err)
                    return
                end

                local key = "test"
                local value, err = redis:get(key)
                if not value then
                    ngx.say("Failed to get key from Redis: ", err)
                else
                    ngx.say("Value of key ", key, ": ", value)
                end

                redis:set_keepalive(100000, 1000)
            }
        }
    }
}
@zhuizhuhaomeng
Copy link
Contributor

What information are you basing this on to determine that keepalive is not working?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants