-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
feat(ext-plugin): avoid sending conf request more times #5183
Conversation
There are two cases where the conf request needs to be forced to be resent: 1. conf has been updated 2. the plugin runner returns 'conf token not found', will retry For case 1, since the key used by the shared dict is lrucache_id, the lrucache_id will need to be updated after the conf is updated, so it is satisfied. For case 2, work in progress Signed-off-by: tzssangglass <tzssangglass@gmail.com>
Signed-off-by: tzssangglass <tzssangglass@gmail.com>
Signed-off-by: tzssangglass <tzssangglass@gmail.com>
t/plugin/ext-plugin/conf_token.t
Outdated
=== TEST 2: share conf token in different workers | ||
--- ext_plugin_cmd | ||
["t/plugin/ext-plugin/runner.sh", "3600"] | ||
--- config | ||
location /t { | ||
content_by_lua_block { | ||
local http = require "resty.http" | ||
local uri = "http://127.0.0.1:" .. ngx.var.server_port .. "/hello" | ||
local function r() | ||
local httpc = http.new() | ||
local res, err = httpc:request_uri(uri) | ||
if not res then | ||
ngx.log(ngx.ERR, err) | ||
return | ||
end | ||
end | ||
|
||
for i = 1, 20 do | ||
r() | ||
ngx.sleep(0.001) | ||
end | ||
ngx.say("done") | ||
} | ||
} | ||
--- response_body | ||
done | ||
--- timeout: 5 | ||
--- error_log | ||
fetch token from shared dict | ||
--- no_error_log | ||
[error] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this test case, I want different workers to handle the "/hello" request in order to verify that the conf token can be shared in different workers, but my local tests show that it is handled by a fixed worker. Is there any way to do this? @spacewander @tokers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about sending requests parallelly?
Signed-off-by: tzssangglass <tzssangglass@gmail.com>
Signed-off-by: tzssangglass <tzssangglass@gmail.com>
Signed-off-by: tzssangglass <tzssangglass@gmail.com>
Signed-off-by: tzssangglass <tzssangglass@gmail.com>
There are two cases where the conf request needs to be forced to be resent:
For case 1, since the key used by the shared dict is lrucache_id, the lrucache_id will need to be updated after the conf is updated, so it is satisfied.
For case 2, work in progress
Signed-off-by: tzssangglass tzssangglass@gmail.com
What this PR does / why we need it:
Pre-submission checklist: