feat(ext-plugin): avoid sending conf request more times#5183
Merged
spacewander merged 10 commits intoapache:masterfrom Oct 18, 2021
Merged
feat(ext-plugin): avoid sending conf request more times#5183spacewander merged 10 commits intoapache:masterfrom
spacewander merged 10 commits intoapache:masterfrom
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>
tzssangglass
commented
Oct 14, 2021
Comment on lines
+110
to
+140
| === 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] |
Member
Author
There was a problem hiding this comment.
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
Member
There was a problem hiding this comment.
What about sending requests parallelly?
Signed-off-by: tzssangglass <tzssangglass@gmail.com>
Signed-off-by: tzssangglass <tzssangglass@gmail.com>
spacewander
reviewed
Oct 17, 2021
Signed-off-by: tzssangglass <tzssangglass@gmail.com>
nic-chen
approved these changes
Oct 17, 2021
Signed-off-by: tzssangglass <tzssangglass@gmail.com>
spacewander
approved these changes
Oct 18, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: