Skip to content

Commit 6eb97da

Browse files
Address review and improve structure and wording
1 parent b86eeb4 commit 6eb97da

File tree

4 files changed

+136
-113
lines changed

4 files changed

+136
-113
lines changed

custom-per-route-options.html.md.erb

Lines changed: 8 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Gorouter supports the following per-route options, described in the sections bel
1212

1313
- `loadbalancing`: Configures the load balancing algorithm used by Gorouter for this particular route. <%= vars.per_route_lb_version %>
1414
- Settings: `round-robin`, `least-connection`, `hash`.
15-
- `hash_header`: Defines the header Gorouter uses for routing decisions on this route. Required when `loadbalancing` is set to `hash`. Cannot be used with other load balancing algorithms. <%= vars.hash_routing_version %>
15+
- `hash_header`: Defines the HTTP header used for hash-based routing decisions. Required when `loadbalancing` is set to `hash`. Cannot be used with other load balancing algorithms. <%= vars.hash_routing_version %>
1616
- `hash_balance`: Sets the float number for the balance factor used by Gorouter to manage load imbalance applying the hash-based routing for this route. Optional when `loadbalancing` is `hash`. Cannot be used with other algorithms. <%= vars.hash_routing_version %>
1717

1818
## <a id="loadbalancing"></a> Configure Gorouter's Load Balancing Algorithm
@@ -21,11 +21,11 @@ Gorouter supports the following per-route options, described in the sections bel
2121

2222
The per-route option `loadbalancing` allows configuring the load balancing algorithm, which defines how the load is distributed between Gorouters and backends.
2323

24-
This option supports three settings for load balancing:
24+
This option supports the following settings for load balancing:
2525

2626
- `round-robin` distributes the load evenly across all available backends
2727
- `least-connection` directs traffic to the backend with the fewest active connections at any given time, optimizing resource utilization
28-
- `hash` distributes requests based on a hash of a specific HTTP header, ensuring requests with the same header are consistently directed to the same backend. <%= vars.hash_routing_version %>
28+
- `hash` distributes requests based on a specific HTTP header value, ensuring requests with the same header value are consistently directed to the same backend. See [Hash-Based Routing](hash-based-routing.html) for details. <%= vars.hash_routing_version %>
2929

3030
### <a id="lb-set-manifest"></a> Configure Load Balancing using an App Manifest
3131

@@ -84,7 +84,8 @@ For example, to change an app route's algorithm from `least-connection` to `roun
8484
```console
8585
cf update-route EXAMPLE.COM --hostname MY-HOST --option loadbalancing=round-robin
8686
```
87-
### <a id="lb-update-route"></a> Remove the Specific Load Balancing Algorithm Using the CF CLI
87+
88+
### <a id="lb-remove-route-option"></a> Remove the Specific Load Balancing Algorithm Using the CF CLI
8889

8990
To remove the `loadbalancing` option from an existing route, run:
9091

@@ -96,93 +97,11 @@ cf update-route EXAMPLE.COM --hostname MY-HOST -r loadbalancing
9697

9798
<%= vars.hash_routing_version %>
9899

99-
Hash-Based Routing is a load-balancing method that routes incoming requests to application instances using a hash of a specific HTTP header value. This ensures consistent routing, so requests with the same header value always go to the same instance. The per-route hash options offer detailed control over hash-based load balancing for individual routes.
100-
101-
### <a id="options-hash-set-manifest"></a> Configure Hash-Based Routing with an App Manifest
102-
1. In the application manifest, include a `route` definition with the following `options` attributes:
103-
- `loadbalancing` set to `hash`
104-
- `hash_header` set to the HTTP header name used for routing decisions
105-
- optionally, `hash_balance` set to a float number for the balance factor used by Gorouter to [manage load imbalance](hash-based-routing.html#handling-imbalance-loads) for this particular route.
106-
107-
```yaml
108-
---
109-
applications:
110-
- name: MY-APP
111-
routes:
112-
- route: MY-HOST.EXAMPLE.COM
113-
options:
114-
loadbalancing: hash
115-
hash_header: HASH-HEADER-NAME
116-
hash_balance: 1.2
117-
```
118-
119-
Where `MY-APP` is the name of your app, `MY-HOST.EXAMPLE.COM` is the route you want to map to your app and `HASH-HEADER-NAME` is the HTTP header name.
120-
121-
1. Push the app with the manifest:
122-
123-
```console
124-
cf push -f manifest.yml
125-
```
126-
127-
### <a id="options-hash-create-route"></a> Create a Route with Hash-Based Options Using the CF CLI
128-
129-
To create a route with hash-specific options, you can use the CLI command `create-route`. For example:
130-
131-
```console
132-
cf create-route EXAMPLE.COM --hostname MY-HOST --option loadbalancing=hash --option hash_header=HASH-HEADER-NAME --option hash_balance=1.2
133-
```
134-
135-
Alternatively, you can use the shorthand `-o` for `--option`. Since `hash_balance` is optional, you can omit it:
136-
137-
```console
138-
cf create-route EXAMPLE.COM --hostname MY-HOST -o loadbalancing=hash -o hash_header=HASH-HEADER-NAME
139-
```
140-
141-
### <a id="options-hash-map-route"></a> Map a Route with Hash Options to an Existing App Using the CF CLI
100+
Hash-Based Routing is a load-balancing method that routes incoming requests to application instances based on a specific HTTP header value. This ensures consistent routing, so requests with the same header value are always routed to the same instance.
142101

143-
To create a new route suitable for hash-based routing and map it to an existing application, you can use the CLI command `map-route`.
102+
For details on Hash-Based Routing concepts, features, and how it compares to Session Affinity, see [Hash-Based Routing](hash-based-routing.html).
144103

145-
For example:
146-
147-
```console
148-
cf map-route MY-APP EXAMPLE.COM --hostname MY-HOST -o loadbalancing=hash -o hash_header=HASH-HEADER-NAME -o hash_balance=1.2
149-
```
150-
151-
<p class="note">
152-
The command <code>map-route</code> supports the <code>--option</code> flag only for new routes.
153-
To update an existing route, see the instructions for <code>update-route</code> below.
154-
155-
### <a id="options-hash-update-route"></a> Update an Existing Route with Hash Options Using the CF CLI
156-
157-
You can change an existing route that uses the default load balancing algorithm to the hash load balancing algorithm.
158-
159-
For example, to change an app route's algorithm from default `round-robin` to `hash` and set `hash_header` to HASH-HEADER-NAME without a balance factor, you can run the `update-route` command:
160-
161-
```console
162-
cf update-route EXAMPLE.COM --hostname MY-HOST -o loadbalancing=hash -o hash_header=HASH-HEADER-NAME
163-
```
164-
165-
To add a balance factor along with the previous settings, you can later run the `update-route` command, for example, with the `hash_balance` option set to `1.5`:
166-
167-
```console
168-
cf update-route EXAMPLE.COM --hostname MY-HOST -o hash_balance=1.5
169-
```
170-
171-
To unset the balance factor, run the `update-route` command with `hash_balance` set to 0.
172-
173-
```console
174-
cf update-route EXAMPLE.COM --hostname MY-HOST -o hash_balance=0
175-
```
176-
177-
Setting the balance factor to 0 indicates to Gorouter that load imbalance is accepted and all requests for a particular hash should be routed to the same instance as long as it's healthy, without redirecting to other predetermined instances.
178-
179-
### <a id="options-hash-revert"></a> Revert Hash Options Using the CF CLI
180-
181-
Running the `update-route` command with the `-r` flag for the option `loadbalancing` removes all hash options from the route, returning to the default load balancing algorithm:
182-
183-
```console
184-
cf update-route EXAMPLE.COM --hostname MY-HOST -r loadbalancing
185-
```
104+
For instructions on configuring hash-based routing using the app manifest or the CF CLI, see [Configure Hash-Based Routing](hash-based-routing.html#configure).
186105

187106
## <a id="lb-retrieve-route-options"></a> Retrieve Route Options
188107

deploy-apps/manifest-attributes.html.md.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ Under each route, you can optionally include an `options` attribute to configure
584584
Available options are:
585585

586586
- `loadbalancing` - defines how Gorouter distributes requests across the application backends. Valid values are `round-robin`, `least-connection` and `hash`.
587-
- `hash_header` - defines the header used for hash-based routing decisions. Required when `loadbalancing` is set to `hash`.
587+
- `hash_header` - defines the HTTP header used for hash-based routing decisions. Required when `loadbalancing` is set to `hash`.
588588
- `hash_balance` - defines the balance factor used to manage load imbalance for hash-based routing. Optional when `loadbalancing` is set to `hash`. Values in the 1.1-2.0 range provide the best balance of even distribution and performance. Omitting `hash_balance` or setting it explicitly to 0 indicates that the load situation will not be considered.
589589

590590
For example:

0 commit comments

Comments
 (0)