-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
refactor(balancer) drop the orderlist property #2748
Conversation
b074f58
to
8bd3b3b
Compare
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.
Very nice. Just left a couple of minor comments. As discussed, this should be scheduled for post 0.11.0/0.10.4 releases.
kong/kong.lua
Outdated
@@ -308,6 +308,7 @@ function Kong.balancer() | |||
current_try.port = addr.port | |||
|
|||
-- set the targets as resolved | |||
ngx.log(ngx.DEBUG, "setting address (try ", addr.try_count, "): ",addr.ip,":",addr.port) |
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.
perf: on this hot code path, let's cache ngx.log
and ngx.DEBUG
which imply global accesses.
style: it seems like we are going over the 80 chars limit and missing a few spaces for readability. Let's use the following form instead:
ngx.log(ngx.DEBUG, "setting address (try ", addr.try_count, "): ",
addr.ip, ":", addr.port)
(with globals caching ofc)
@@ -167,7 +186,7 @@ dao_helpers.for_each_dao(function(kong_config) | |||
assert.are.equal(requests/2, count1) | |||
assert.are.equal(requests/2, count2) | |||
end) | |||
it("adding a target", function() | |||
it("adding a target #only", function() |
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.
#only ^
8bd3b3b
to
714adeb
Compare
92b67fa
to
90466c6
Compare
90466c6
to
6e85b52
Compare
kong-0.11.0-0.rockspec
Outdated
@@ -27,7 +27,7 @@ dependencies = { | |||
"luacrypto == 0.3.2", | |||
"luasyslog == 1.0.0", | |||
"lua_pack == 1.0.5", | |||
"lua-resty-dns-client == 0.6.0", | |||
"lua-resty-dns-client == 0.6.1", |
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.
Should we bump this to 0.6.2 now? Considering master is already there.
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.
@thibaultcha Done!
6e85b52
to
bb207f6
Compare
This removes the `orderlist` property from the balancer entity. Due to a different implementation in the dns library, it is no longer required. from #2748
This removes the `orderlist` property from the balancer entity. Due to a different implementation in the dns library, it is no longer required. from #2748
This removes the orderlist property from the balancer entity. Due to a different implementation in the dns library, it is no longer required.
Reason:
Because multiple Kong nodes need the exact same ring-balancer, the orderlist was used to make sure they all used the same random data to set up the balancer.
This has now been replaced by using a separate randomizer in the dns library, which always will be seeded again, and with the same seed. This causes the exact same random set of numbers to be generated. This works because there is no need for uniqueness, there is only need for distribution of the data.