Skip to content

fix(etcd): reuse cli and enable keepalive#9420

Merged
juststillthinking merged 4 commits into
apache:masterfrom
kingluo:fix-etcd-http-keepalive
May 17, 2023
Merged

fix(etcd): reuse cli and enable keepalive#9420
juststillthinking merged 4 commits into
apache:masterfrom
kingluo:fix-etcd-http-keepalive

Conversation

@kingluo

@kingluo kingluo commented May 6, 2023

Copy link
Copy Markdown
Contributor

Description

  1. The JWT auth token is stored in the etcd cli table, so reuse the table between calls to avoid repeat auth calls.
  2. The path between conf server and etcd should enable keepalive so that we could reuse the same connection to do etcd calls. Besides avoiding connection overhead, the etcd v3 uses connection based auth.

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@kingluo
kingluo marked this pull request as ready for review May 11, 2023 16:24
Comment thread t/core/config_etcd.t
Comment thread t/core/etcd.t
content_by_lua_block {
local etcd_lib = require("resty.etcd")
-- the mock won't take effect when using gRPC because the connection will be cached
etcd_lib.new = function()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hijacking resty.etcd.new does not work after the cli is created once, because it's reused afterwards.

leslie-tsang
leslie-tsang previously approved these changes May 16, 2023
@leslie-tsang
leslie-tsang self-requested a review May 17, 2023 01:05
Comment thread t/core/config_etcd.t
@juststillthinking
juststillthinking merged commit 68287e9 into apache:master May 17, 2023
AlinsRan pushed a commit to AlinsRan/apisix that referenced this pull request Jul 7, 2023
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

Successfully merging this pull request may close these issues.

3 participants