From cb6a91a62b6b6bf1573b73854f475a82147e9b70 Mon Sep 17 00:00:00 2001 From: jeremyhi Date: Wed, 13 Nov 2024 18:51:02 +0800 Subject: [PATCH] docs: the default selector changed (#1282) Co-authored-by: Yiran --- docs/contributor-guide/metasrv/selector.md | 23 +++++++++++-------- .../contributor-guide/metasrv/selector.md | 23 +++++++++++-------- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/docs/contributor-guide/metasrv/selector.md b/docs/contributor-guide/metasrv/selector.md index 12781efc2..adb166724 100644 --- a/docs/contributor-guide/metasrv/selector.md +++ b/docs/contributor-guide/metasrv/selector.md @@ -10,30 +10,33 @@ There is a specific scenario in `Metasrv` service. When a request to create a ta ## Selector Type -Currently, there are two types of `Selector` available in the `Metasrv` service: `LeasebasedSelector` and `LoadBasedSelector`. +The `Metasrv` service currently offers the following types of `Selectors`: -### LeasebasedSelector [not recommended] +### LeasebasedSelector -`LeasebasedSelector` is just a simple implementation of `Selector`, but **it is not recommended**. - -It shuffles available `Datanode`s, and returns the list. +`LeasebasedSelector` randomly selects from all available (in lease) `Datanode`s, its characteristic is simplicity and fast. ### LoadBasedSelector -`LoadBasedSelector` is another implementation of the `Selector`. +The `LoadBasedSelector` load value is determined by the number of regions on each `Datanode`, fewer regions indicate lower load, and `LoadBasedSelector` prioritizes selecting low-load `Datanodes`. -It sorts available `Datanode`s according to the load, and returns a sorted list of these `Datanode`s. +### RoundRobinSelector [default] +`RoundRobinSelector` selects `Datanode`s in a round-robin fashion. It is recommended and the default option in most cases. If you're unsure which to choose, it's usually the right choice. ## Configuration -You can configure the `Selector` when starting the `Metasrv` service, with the default being `LoadBasedSelector`. +You can configure the `Selector` by its name when starting the `Metasrv` service. + +- LeasebasedSelector: `lease_based` or `LeaseBased` +- LoadBasedSelector: `load_based` or `LoadBased` +- RoundRobinSelector: `round_robin` or `RoundRobin` For example: ```shell -cargo run -- metasrv start --selector load_based +cargo run -- metasrv start --selector round_robin ``` ```shell -cargo run -- metasrv start --selector lease_based +cargo run -- metasrv start --selector RoundRobin ``` diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/contributor-guide/metasrv/selector.md b/i18n/zh/docusaurus-plugin-content-docs/current/contributor-guide/metasrv/selector.md index 88f928f99..dc2faeef7 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/contributor-guide/metasrv/selector.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/contributor-guide/metasrv/selector.md @@ -10,30 +10,33 @@ ## Selector 类型 -目前,在 `Metasrv` 中有两种类型的 `Selector` 可用:`LeasebasedSelector` 和 `LoadBasedSelector`。 +`Metasrv` 目前提供以下几种类型的 `Selectors`: -### LeasebasedSelector [不推荐] +### LeasebasedSelector -`LeasebasedSelector` 只是 `Selector` 的一个简单实现,但并不推荐。 - -它会对可用的 `Datanode`s 进行随机排序,然后返回列表。 +`LeasebasedSelector` 从所有可用的(也就是在租约期间内)`Datanode` 中随机选择,其特点是简单和快速。 ### LoadBasedSelector -`LoadBasedSelector` 是 `Selector` 的另一种实现。 +`LoadBasedSelector` 按照负载来选择,负载值则由每个 `Datanode` 上的 region 数量决定,较少的 region 表示较低的负载,`LoadBasedSelector` 优先选择低负载的 `Datanode`。 -它根据负载对可用的 `Datanode`s 进行排序,然后返回一个已排序的 `Datanode` 列表。 +### RoundRobinSelector [默认选项] +`RoundRobinSelector` 以轮询的方式选择 `Datanode`。在大多数情况下,这是默认的且推荐的选项。如果你不确定选择哪个,通常它就是正确的选择。 ## 配置 -在启动 `Metasrv` 服务时,您可以配置 `Selector`,默认值是 `LoadBasedSelector`。 +您可以在启动 `Metasrv` 服务时通过名称配置 `Selector`。 + +- LeasebasedSelector: `lease_based` 或 `LeaseBased` +- LoadBasedSelector: `load_based` 或 `LoadBased` +- RoundRobinSelector: `round_robin` 或 `RoundRobin` 例如: ```shell -cargo run -- metasrv start --selector load_based +cargo run -- metasrv start --selector round_robin ``` ```shell -cargo run -- metasrv start --selector lease_based +cargo run -- metasrv start --selector RoundRobin ```