Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
Signed-off-by: Lukasz Dziedziak <[email protected]>
  • Loading branch information
lukidzi committed Nov 13, 2023
1 parent 23fe119 commit dd827ed
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
6 changes: 6 additions & 0 deletions app/_src/policies/locality-aware.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
title: Locality-aware Load Balancing
---

{% if_version gte:2.5.x %}
{% warning %}
If you are looking for more advanced configuration use [MeshLoadBalancingStrategy](/docs/{{ page.version }}/policies/meshloadbalancingstrategy).

Check warning on line 7 in app/_src/policies/locality-aware.md

View workflow job for this annotation

GitHub Actions / Lint docs

[vale] reported by reviewdog 🐶 [Google.Parens] Use parentheses judiciously. Raw Output: {"message": "[Google.Parens] Use parentheses judiciously.", "location": {"path": "app/_src/policies/locality-aware.md", "range": {"start": {"line": 7, "column": 83}}}, "severity": "INFO"}
{% endwarning %}
{% endif_version %}

In a {% if_version lte:2.1.x %}[multi-zone deployment](/docs/{{ page.version }}/introduction/deployments/){% endif_version %}{% if_version gte:2.2.x %}[multi-zone deployment](/docs/{{ page.version }}/production/deployment/){% endif_version %}, locality-aware load balancing
instructs data plane proxies to try to keep requests within one zone. The amount
of traffic that remains in one zone depends on the health of the service endpoints in that
Expand Down
19 changes: 14 additions & 5 deletions app/_src/policies/meshloadbalancingstrategy.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,35 @@ To learn more about the information in this table, see the [matching docs](/docs

## Configuration

{% if_version lte:2.4.x %}
### LocalityAwareness

Locality-aware load balancing is enabled by default unlike its predecessor [localityAwareLoadBalancing](/docs/{{ page.version }}/policies/locality-aware).

- **`disabled`** – (optional) allows to disable locality-aware load balancing. When disabled requests are distributed
across all endpoints regardless of locality.

{% endif_version %}
{% if_version gte:2.5.x %}
### Advanced LocalityAwareness
Advanced locality-aware load balancing provides a more robust and straightforward method for balancing traffic within and across zones. This not only allows you to route traffic across zones when the local zone service is unhealthy but also enables you to define traffic prioritization within the local zone and set cross-zone fallback priorities.
### LocalityAwareness

Check warning on line 36 in app/_src/policies/meshloadbalancingstrategy.md

View workflow job for this annotation

GitHub Actions / Lint docs

[vale] reported by reviewdog 🐶 [Google.Headings] 'LocalityAwareness' should use sentence-style capitalization. Raw Output: {"message": "[Google.Headings] 'LocalityAwareness' should use sentence-style capitalization.", "location": {"path": "app/_src/policies/meshloadbalancingstrategy.md", "range": {"start": {"line": 36, "column": 5}}}, "severity": "WARNING"}
Locality-aware load balancing provides a more robust and straightforward method for balancing traffic within and across zones. This not only allows you to route traffic across zones when the local zone service is unhealthy but also enables you to define traffic prioritization within the local zone and set cross-zone fallback priorities.

#### Default behaviour
Locality-aware load balancing is enabled by default, unlike its predecessor [localityAwareLoadBalancing](/docs/{{ page.version }}/policies/locality-aware). Requests are distributed across all endpoints within the local zone first unless there are not enough healthy endpoints.

Check warning on line 40 in app/_src/policies/meshloadbalancingstrategy.md

View workflow job for this annotation

GitHub Actions / Lint docs

[vale] reported by reviewdog 🐶 [Google.Passive] In general, use active voice instead of passive voice ('is enabled'). Raw Output: {"message": "[Google.Passive] In general, use active voice instead of passive voice ('is enabled').", "location": {"path": "app/_src/policies/meshloadbalancingstrategy.md", "range": {"start": {"line": 40, "column": 31}}}, "severity": "INFO"}

Check warning on line 40 in app/_src/policies/meshloadbalancingstrategy.md

View workflow job for this annotation

GitHub Actions / Lint docs

[vale] reported by reviewdog 🐶 [Google.Parens] Use parentheses judiciously. Raw Output: {"message": "[Google.Parens] Use parentheses judiciously.", "location": {"path": "app/_src/policies/meshloadbalancingstrategy.md", "range": {"start": {"line": 40, "column": 105}}}, "severity": "INFO"}

Check warning on line 40 in app/_src/policies/meshloadbalancingstrategy.md

View workflow job for this annotation

GitHub Actions / Lint docs

[vale] reported by reviewdog 🐶 [Google.Passive] In general, use active voice instead of passive voice ('are distributed'). Raw Output: {"message": "[Google.Passive] In general, use active voice instead of passive voice ('are distributed').", "location": {"path": "app/_src/policies/meshloadbalancingstrategy.md", "range": {"start": {"line": 40, "column": 166}}}, "severity": "INFO"}

Check warning on line 40 in app/_src/policies/meshloadbalancingstrategy.md

View workflow job for this annotation

GitHub Actions / Lint docs

[vale] reported by reviewdog 🐶 [Google.Contractions] Use 'aren't' instead of 'are not'. Raw Output: {"message": "[Google.Contractions] Use 'aren't' instead of 'are not'.", "location": {"path": "app/_src/policies/meshloadbalancingstrategy.md", "range": {"start": {"line": 40, "column": 244}}}, "severity": "INFO"}

#### Disabling cross zone routing
It's possible to disable cross-zone traffic. In this case, all endpoints are treated equally.

Check warning on line 43 in app/_src/policies/meshloadbalancingstrategy.md

View workflow job for this annotation

GitHub Actions / Lint docs

[vale] reported by reviewdog 🐶 [Google.WordList] Use 'turn off' or 'off' instead of 'disable'. Raw Output: {"message": "[Google.WordList] Use 'turn off' or 'off' instead of 'disable'.", "location": {"path": "app/_src/policies/meshloadbalancingstrategy.md", "range": {"start": {"line": 43, "column": 18}}}, "severity": "WARNING"}

Check warning on line 43 in app/_src/policies/meshloadbalancingstrategy.md

View workflow job for this annotation

GitHub Actions / Lint docs

[vale] reported by reviewdog 🐶 [Google.Passive] In general, use active voice instead of passive voice ('are treated'). Raw Output: {"message": "[Google.Passive] In general, use active voice instead of passive voice ('are treated').", "location": {"path": "app/_src/policies/meshloadbalancingstrategy.md", "range": {"start": {"line": 43, "column": 74}}}, "severity": "INFO"}

#### Configuring LocalityAware Load Balancing

Check warning on line 45 in app/_src/policies/meshloadbalancingstrategy.md

View workflow job for this annotation

GitHub Actions / Lint docs

[vale] reported by reviewdog 🐶 [Google.Headings] 'Configuring LocalityAware Load Balancing' should use sentence-style capitalization. Raw Output: {"message": "[Google.Headings] 'Configuring LocalityAware Load Balancing' should use sentence-style capitalization.", "location": {"path": "app/_src/policies/meshloadbalancingstrategy.md", "range": {"start": {"line": 45, "column": 6}}}, "severity": "WARNING"}
- **`disabled`** – (optional) allows to disable locality-aware load balancing. When disabled requests are distributed across all endpoints regardless of locality.

Check failure on line 46 in app/_src/policies/meshloadbalancingstrategy.md

View workflow job for this annotation

GitHub Actions / Lint docs

[vale] reported by reviewdog 🐶 [Google.EmDash] Don't put a space before or after a dash. Raw Output: {"message": "[Google.EmDash] Don't put a space before or after a dash.", "location": {"path": "app/_src/policies/meshloadbalancingstrategy.md", "range": {"start": {"line": 46, "column": 17}}}, "severity": "ERROR"}

Check failure on line 46 in app/_src/policies/meshloadbalancingstrategy.md

View workflow job for this annotation

GitHub Actions / Lint docs

[vale] reported by reviewdog 🐶 [Google.EnDash] Use an em dash ('—') instead of '–'. Raw Output: {"message": "[Google.EnDash] Use an em dash ('—') instead of '–'.", "location": {"path": "app/_src/policies/meshloadbalancingstrategy.md", "range": {"start": {"line": 46, "column": 18}}}, "severity": "ERROR"}

Check warning on line 46 in app/_src/policies/meshloadbalancingstrategy.md

View workflow job for this annotation

GitHub Actions / Lint docs

[vale] reported by reviewdog 🐶 [Google.Parens] Use parentheses judiciously. Raw Output: {"message": "[Google.Parens] Use parentheses judiciously.", "location": {"path": "app/_src/policies/meshloadbalancingstrategy.md", "range": {"start": {"line": 46, "column": 20}}}, "severity": "INFO"}

#### LocalZone
Local zone routing allows you to define traffic routing rules within a local zone, prioritizing data planes based on tags and their associated weights. This enables you to allocate specific traffic percentages to data planes with particular tags within the local zone. If there are no healthy endpoints within the highest priority group, the next priority group takes precedence. Locality awareness within the local zone relies on tags within inbounds, so it's crucial to ensure that the tags used in the policy are defined for the service (Dataplane object on Universal, PodTemplate labels on Kubernetes).

- **`localZone`** - (optional) allows to define load balancing priorities between dataplanes in the local zone. When not defined, traffic is distributed equally to all endpoints within the local zone.
- **`affinityTags`** - list of tags and their weights based on which traffic is load balanced
- **`key`** - defines tag for which affinity is configured. The tag needs to be configured on the inbound of the service. In case of Kubernetes, pod needs to have a label. On Universal user needs to define it on the inbound of the service. If the tag is absent this entry is skipped.
- **`weight`** - (optional) weight of the tag used for load balancing. The bigger the weight the higher number of requests is routed to dataplanes with specific tag. By default we will adjust them so that 90% traffic goes to first tag, 9% to next, and 1% to third and so on.

#### CrossZone
{% warning %}
Remember that cross-zone traffic requires [mTLS to be enabled](/docs/{{ page.version}}/policies/mutual-tls).
{% endwarning %}
Expand Down Expand Up @@ -306,7 +315,7 @@ spec:

### Disable cross zone traffic and route to the local zone instances equally

In this example, when a user sends a request to the backend service, the request is routed equally to all instances in the local zone. If there are no instances in the local zone, the request will fail because there is no cross-zone traffic.
In this example, when a user sends a request to the backend service, the request is routed equally to all instances in the local zone. If there are no instances in the local zone, the request will fail because there is no cross zone traffic.

{% policy_yaml local-zone-affinity-backend-2 %}
```yaml
Expand Down

0 comments on commit dd827ed

Please sign in to comment.