Skip to content

Commit

Permalink
fix(balancer) update default size from 100 to 10000
Browse files Browse the repository at this point in the history
The original size was way to low to guarantee proper random
distribution beyond  3-4 targets. The recommended size is 100
slots per target. The new default covers up to 100 targets.

The approximate footprint per Upstream:
- 65535 slots, 100 targets: 1.6MB
- 10000 slots, 100 targets: 375kB

This fix should have been included in the latest update of the
DNS library dependency.

Related #3220 
From #3296
  • Loading branch information
Tieske authored and thibaultcha committed Mar 20, 2018
1 parent 20bbda4 commit 9648691
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion kong/dao/schemas/upstreams.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local utils = require "kong.tools.utils"
local match = string.match
local sub = string.sub

local DEFAULT_SLOTS = 100
local DEFAULT_SLOTS = 10000
local SLOTS_MIN, SLOTS_MAX = 10, 2^16
local SLOTS_MSG = "number of slots must be between " .. SLOTS_MIN .. " and " .. SLOTS_MAX

Expand Down
2 changes: 1 addition & 1 deletion spec-old-api/01-unit/007-entities_schemas_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ describe("Entities Schemas", function()
--

describe("Upstreams", function()
local slots_default, slots_min, slots_max = 100, 10, 2^16
local slots_default, slots_min, slots_max = 10000, 10, 2^16

it("should require a valid `name` and no port", function()
local valid, errors, check
Expand Down
2 changes: 1 addition & 1 deletion spec/01-unit/007-entities_schemas_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ describe("Entities Schemas", function()
--

describe("Upstreams", function()
local slots_default, slots_min, slots_max = 100, 10, 2^16
local slots_default, slots_min, slots_max = 10000, 10, 2^16

it("should require a valid `name` and no port", function()
local valid, errors, check
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local dao_helpers = require "spec.02-integration.03-dao.helpers"
local cjson = require "cjson"
local DAOFactory = require "kong.dao.factory"

local slots_default, slots_max = 100, 2^16
local slots_default, slots_max = 10000, 2^16

local function it_content_types(title, fn)
local test_form_encoded = fn("application/x-www-form-urlencoded")
Expand Down

0 comments on commit 9648691

Please sign in to comment.