Skip to content

Commit

Permalink
server/balancer: add scheduler and simplify schedule configs (#396)
Browse files Browse the repository at this point in the history
The original balance configs are complicated and some of them are very
confusing, now we simplify them to make it more easy to understand.

We replace the concept of "balance" with "schedule". Balance means to
keep the resource balance, but we will introduce different kinds of
strategies in the future which may not balance, and balance is just one
kind of strategies to schedule resources between stores.
  • Loading branch information
huachaohuang committed Nov 29, 2016
1 parent 006b353 commit a74bd9c
Show file tree
Hide file tree
Showing 12 changed files with 584 additions and 853 deletions.
25 changes: 10 additions & 15 deletions conf/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,16 @@ tso-save-interval = "3s"
max-peer-count = 3


[balance]
min-capacity-used-ratio = 0.1
max-capacity-used-ratio = 0.9
max-leader-count = 10
max-sending-snap-count = 3
max-receiving-snap-count = 3
max-applying-snap-count = 3
max-diff-score-fraction = 0.1
balance-interval = 30
max-balance-count = 16
max-balance-retry-per-loop = 10
max-balance-count-per-loop = 3
max-transfer-wait-count = 3
max-peer-down-duration = "30m"
max-store-down-duration = "10m"
[schedule]
min-region-count = 10
min-leader-count = 10
max-snapshot-count = 3
min-balance-diff-ratio = 0.01
max-store-down-duration = "30m"
balance-interval = "30s"
max-balance-count = 4
max-balance-retry-per-loop = 4
max-balance-count-per-loop = 1

[metric]
# prometheus client push interval, set "0s" to disable prometheus.
Expand Down
4 changes: 2 additions & 2 deletions server/api/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ func (h *confHandler) Get(w http.ResponseWriter, r *http.Request) {
}

func (h *confHandler) Post(w http.ResponseWriter, r *http.Request) {
config := &server.BalanceConfig{}
config := &server.ScheduleConfig{}
err := readJSON(r.Body, config)
if err != nil {
h.rd.JSON(w, http.StatusInternalServerError, err.Error())
return
}

h.svr.SetBalanceConfig(*config)
h.svr.SetScheduleConfig(*config)
h.rd.JSON(w, http.StatusOK, nil)
}
Loading

0 comments on commit a74bd9c

Please sign in to comment.