zuplo 7.14.5 → 7.14.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/ai-gateway/cookbooks/data-residency.mdx +259 -0
- package/docs/ai-gateway/fallback.mdx +6 -4
- package/docs/ai-gateway/guardrails.mdx +283 -0
- package/docs/ai-gateway/observability/analytics.mdx +121 -0
- package/docs/ai-gateway/observability/data-handling.mdx +120 -0
- package/docs/ai-gateway/observability/tracing.mdx +203 -0
- package/docs/ai-gateway/overview.mdx +6 -4
- package/docs/ai-gateway/policies/overview.mdx +4 -0
- package/docs/ai-gateway/policy-chains.mdx +10 -3
- package/docs/ai-gateway/routing.mdx +277 -0
- package/docs/analytics/overview.md +3 -0
- package/docs/analytics/tabs/cache.md +89 -0
- package/docs/articles/connect-to-aws-alb-with-mtls.mdx +23 -0
- package/docs/articles/deployments-and-rollbacks.mdx +93 -0
- package/docs/articles/proxy-openai-realtime-api.mdx +247 -0
- package/docs/caching/gateway-caching.mdx +2 -1
- package/docs/caching/semantic-caching.mdx +133 -0
- package/docs/cli/lint.mdx +13 -0
- package/docs/cli/variable-delete.mdx +66 -0
- package/docs/concepts/source-control-and-deployment.mdx +6 -0
- package/docs/concepts/upstream-credentials.mdx +2 -1
- package/docs/guides/backend-failover.mdx +117 -0
- package/docs/guides/blue-green-deployments.mdx +199 -0
- package/docs/handlers/websocket-pipeline-handler.mdx +94 -0
- package/docs/mcp-server/authorize-tool-calls.mdx +284 -0
- package/docs/mcp-server/overview.mdx +3 -0
- package/docs/policies/mcp-capability-filter-inbound/doc.md +101 -1
- package/docs/policies/semantic-cache-inbound/doc.md +6 -5
- package/docs/policies/semantic-cache-inbound/schema.json +4 -4
- package/package.json +5 -5
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: AI Gateway routing and reliability
|
|
3
|
+
sidebar_label: Routing and reliability
|
|
4
|
+
description:
|
|
5
|
+
Pick the model for each AI Gateway request with load balancing or Smart
|
|
6
|
+
Router, and keep apps serving with fallback models, timeouts, and quota
|
|
7
|
+
fallbacks.
|
|
8
|
+
applies_to:
|
|
9
|
+
product: gateway
|
|
10
|
+
hosting: all
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
An app's [policy chain](./policy-chains.mdx) decides which model serves each
|
|
14
|
+
request and what happens when that model fails or a budget runs out. Three
|
|
15
|
+
policies cover this, and you can combine them in one chain:
|
|
16
|
+
|
|
17
|
+
| You want to | Use | How it picks or changes the model |
|
|
18
|
+
| --------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
|
|
19
|
+
| Spread requests across deployments, accounts, or providers to combine rate limits | [Model Load Balancing](../policies/ai-gateway-load-balancing-inbound.mdx) | Round robin through a list, or sticky routing that keeps a user or conversation on one model |
|
|
20
|
+
| Send simple prompts to a cheaper model and hard prompts to a stronger one | [Smart Router](../policies/ai-gateway-smart-router-inbound.mdx) | Classifies each prompt's complexity as `low`, `medium`, or `high` and routes to the model for that level |
|
|
21
|
+
| Keep serving when the model errors, is rate limited, or is slow to respond | [Fallback Model](../policies/ai-gateway-fallback-model-inbound.mdx) `fallback` | Moves the request to a backup model after a retryable failure or timeout |
|
|
22
|
+
| Keep serving, on a cheaper model, after a budget runs out | [Fallback Model](../policies/ai-gateway-fallback-model-inbound.mdx) `quotaFallback` | Sends the request to a quota fallback model instead of returning `429` |
|
|
23
|
+
|
|
24
|
+
[Model Filtering](../policies/ai-gateway-model-filtering-inbound.mdx) is the
|
|
25
|
+
simplest way to pick a model: the client names the model, and Model Filtering
|
|
26
|
+
accepts it, rejects it, or supplies a default from an allow list. The policies
|
|
27
|
+
on this page build on that selection or replace it.
|
|
28
|
+
|
|
29
|
+
<Diagram height="h-72">
|
|
30
|
+
<DiagramNode id="request">Request</DiagramNode>
|
|
31
|
+
<DiagramNode id="pick" variant="zuplo">
|
|
32
|
+
Pick the model: Model Filtering, Model Load Balancing, or Smart Router
|
|
33
|
+
</DiagramNode>
|
|
34
|
+
<DiagramNode id="fallback" variant="zuplo">
|
|
35
|
+
Fallback Model adds a backup and a quota fallback
|
|
36
|
+
</DiagramNode>
|
|
37
|
+
<DiagramNode id="budget" variant="orange">
|
|
38
|
+
Budget check
|
|
39
|
+
</DiagramNode>
|
|
40
|
+
<DiagramNode id="primary" variant="blue">
|
|
41
|
+
Chosen model
|
|
42
|
+
</DiagramNode>
|
|
43
|
+
<DiagramNode id="quota" variant="blue">
|
|
44
|
+
Quota fallback model
|
|
45
|
+
</DiagramNode>
|
|
46
|
+
<DiagramNode id="backup" variant="blue">
|
|
47
|
+
Backup model
|
|
48
|
+
</DiagramNode>
|
|
49
|
+
<DiagramEdge from="request" to="pick" />
|
|
50
|
+
<DiagramEdge from="pick" to="fallback" />
|
|
51
|
+
<DiagramEdge from="fallback" to="budget" />
|
|
52
|
+
<DiagramEdge from="budget" to="primary" label="within budget" />
|
|
53
|
+
<DiagramEdge from="budget" to="quota" label="over budget" />
|
|
54
|
+
<DiagramEdge
|
|
55
|
+
from="primary"
|
|
56
|
+
to="backup"
|
|
57
|
+
label="retryable failure"
|
|
58
|
+
lineStyle="dashed"
|
|
59
|
+
/>
|
|
60
|
+
<DiagramEdge
|
|
61
|
+
from="quota"
|
|
62
|
+
to="backup"
|
|
63
|
+
label="retryable failure"
|
|
64
|
+
lineStyle="dashed"
|
|
65
|
+
/>
|
|
66
|
+
</Diagram>
|
|
67
|
+
|
|
68
|
+
## Model Load Balancing
|
|
69
|
+
|
|
70
|
+
[Model Load Balancing](../policies/ai-gateway-load-balancing-inbound.mdx)
|
|
71
|
+
spreads requests across a list of models. Use it to combine the rate limits of
|
|
72
|
+
several deployments of one model, to serve one model from more than one
|
|
73
|
+
provider, or to split traffic across different models. The policy picks the
|
|
74
|
+
model for every request it handles, so the list also limits which models clients
|
|
75
|
+
can reach. Clients still send a `model`, but any value works.
|
|
76
|
+
|
|
77
|
+
Choose a `strategy`:
|
|
78
|
+
|
|
79
|
+
| Strategy | How it picks a model | Use it to |
|
|
80
|
+
| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
|
|
81
|
+
| `round-robin` (default) | Cycles through the list | Spread load evenly across deployments, accounts, or providers |
|
|
82
|
+
| `sticky` | Sends every request with the same key to the same model, on every gateway instance. Set `stickyBy` to `user`, `conversation`, or `expression` to choose the key | Keep each caller on one model, or keep each conversation on the deployment whose prompt cache already holds it |
|
|
83
|
+
|
|
84
|
+
With AI Gateway API keys, `stickyBy: "user"` keeps each app on one model. To
|
|
85
|
+
keep each end user on one model, have the app send an end-user ID in a header,
|
|
86
|
+
set `stickyBy` to `expression`, and set `expression` to a selector such as
|
|
87
|
+
`request.headers.get("x-end-user-id")`.
|
|
88
|
+
|
|
89
|
+
Most requests also get a **retry model**: the model the strategy would pick
|
|
90
|
+
next. With `sticky` routing, the retry model is stable for each key too. The
|
|
91
|
+
gateway moves a request to the retry model when the chosen model fails:
|
|
92
|
+
|
|
93
|
+
| When the chosen model | Chat Completions and Embeddings | Responses and Messages |
|
|
94
|
+
| ---------------------------------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- |
|
|
95
|
+
| Returns `429` | Retries it twice, then moves to the retry model | Retries it twice, then moves to the retry model |
|
|
96
|
+
| Returns a `5xx`, `408`, or `425` status, or the gateway can't reach it | Moves to the retry model | Fails the request |
|
|
97
|
+
| Doesn't start responding within `fallbackTimeoutSeconds` | Moves to the retry model | Keeps waiting |
|
|
98
|
+
|
|
99
|
+
Each request tries at most two models. `fallbackTimeoutSeconds` defaults to 60
|
|
100
|
+
seconds.
|
|
101
|
+
|
|
102
|
+
## Smart Router
|
|
103
|
+
|
|
104
|
+
[Smart Router](../policies/ai-gateway-smart-router-inbound.mdx) classifies the
|
|
105
|
+
last user prompt of each Chat Completions, Responses, and Messages request by
|
|
106
|
+
intent and complexity, then routes the request to the model you assign to that
|
|
107
|
+
complexity in `modelsByComplexity`:
|
|
108
|
+
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"classifier": {
|
|
112
|
+
"app": {
|
|
113
|
+
"appId": "$env(CLASSIFIER_APP_ID)",
|
|
114
|
+
"model": "openai/gpt-4o-mini"
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"modelsByComplexity": {
|
|
118
|
+
"low": "openai/gpt-4o-mini",
|
|
119
|
+
"medium": "openai/gpt-4o",
|
|
120
|
+
"high": "openai/gpt-5"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
The classifier runs on another app on the same gateway, in-process, so its cost
|
|
126
|
+
shows up under that app and counts toward that app's budgets. Give the
|
|
127
|
+
classifier app the [Internal Only](../policies/internal-only-inbound.mdx) policy
|
|
128
|
+
instead of API Key Authentication, and keep Smart Router off its chain.
|
|
129
|
+
|
|
130
|
+
Smart Router routes a request only when the classification is confident enough
|
|
131
|
+
(`minConfidenceForRouting`, `0.5` by default) and the intent is one it knows. If
|
|
132
|
+
the classifier fails or times out, the request continues to the model it would
|
|
133
|
+
have used without Smart Router. To try a classifier without changing any
|
|
134
|
+
routing, set `smartRoutingEnabled` to `false` and read the results in a later
|
|
135
|
+
policy.
|
|
136
|
+
|
|
137
|
+
## Fallback Model
|
|
138
|
+
|
|
139
|
+
[Fallback Model](../policies/ai-gateway-fallback-model-inbound.mdx) adds two
|
|
140
|
+
independent backups to the model that an earlier policy picked. It never picks a
|
|
141
|
+
primary model itself, so place it after the policy that does.
|
|
142
|
+
|
|
143
|
+
- `fallback`: the model the gateway tries after a retryable failure (a `5xx`,
|
|
144
|
+
`408`, `425`, or `429` status, or a network failure) or after the primary
|
|
145
|
+
doesn't start responding within `fallbackTimeoutSeconds`. The timeout defaults
|
|
146
|
+
to 60 seconds and accepts 1 through 300. Responses and Messages requests move
|
|
147
|
+
to the `fallback` only when the primary keeps returning `429`.
|
|
148
|
+
- `quotaFallback`: the model the gateway uses when an app, pool, or gateway
|
|
149
|
+
**Block** budget runs out, instead of returning `429 Too Many Requests`.
|
|
150
|
+
|
|
151
|
+
The backups can be on any provider. After Model Load Balancing, a `fallback`
|
|
152
|
+
becomes the request's retry model in place of the list's next pick. For the
|
|
153
|
+
setup steps and how the two backups combine, see
|
|
154
|
+
[Fallback Models](./fallback.mdx).
|
|
155
|
+
|
|
156
|
+
## Quota fallback
|
|
157
|
+
|
|
158
|
+
Budgets come from the [usage limits](./usage-limits.mdx) at the gateway, pool,
|
|
159
|
+
and app levels, and from **Budgets and Costs** in the app's chain. When a
|
|
160
|
+
**Block** budget runs out, requests to a provider go to the `quotaFallback`
|
|
161
|
+
model, usually a smaller and cheaper one, so the app keeps answering while
|
|
162
|
+
overflow traffic costs less. The quota fallback's own usage still counts toward
|
|
163
|
+
every applicable limit. Without a `quotaFallback`, the gateway returns `429`.
|
|
164
|
+
|
|
165
|
+
A cache hit doesn't use the quota fallback. When a **Block** budget runs out,
|
|
166
|
+
cache hits return `429`. See
|
|
167
|
+
[Successful cache responses](./usage-limits.mdx#successful-cache-responses).
|
|
168
|
+
|
|
169
|
+
## Put them in order
|
|
170
|
+
|
|
171
|
+
Place the policy that picks the model first, then Fallback Model, then Budgets
|
|
172
|
+
and Costs and Semantic Cache:
|
|
173
|
+
|
|
174
|
+
```text
|
|
175
|
+
API Key Authentication
|
|
176
|
+
→ Model Load Balancing (or Model Filtering → Smart Router)
|
|
177
|
+
→ Fallback Model
|
|
178
|
+
→ Budgets and Costs
|
|
179
|
+
→ Semantic Cache
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
- **API Key Authentication** comes first, so sticky routing by `user` has a
|
|
183
|
+
caller to key on.
|
|
184
|
+
- **Model Load Balancing** doesn't need Model Filtering for the request types it
|
|
185
|
+
has a list for, because its list already limits which models clients reach. If
|
|
186
|
+
Model Filtering runs first, its selection stands and Model Load Balancing does
|
|
187
|
+
nothing.
|
|
188
|
+
- **Smart Router** goes after Model Filtering, so the allow list checks the
|
|
189
|
+
client's model first. When Smart Router routes a request, its model wins over
|
|
190
|
+
a Model Load Balancing pick, and the request loses the list's retry model.
|
|
191
|
+
Place Fallback Model after Smart Router so routed requests still get its
|
|
192
|
+
backups.
|
|
193
|
+
- **Fallback Model** comes after the policy that picks the model. It adds
|
|
194
|
+
nothing to a request that has no selection yet.
|
|
195
|
+
|
|
196
|
+
To add guardrails to the same chain, see the
|
|
197
|
+
[recommended starting chain](./guardrails.mdx#recommended-starting-chain).
|
|
198
|
+
|
|
199
|
+
## Example: two deployments with a budget
|
|
200
|
+
|
|
201
|
+
This app spreads traffic across two Azure deployments of the same model to
|
|
202
|
+
combine their rate limits, and moves to a cheaper model when its monthly budget
|
|
203
|
+
runs out.
|
|
204
|
+
|
|
205
|
+
Model Load Balancing:
|
|
206
|
+
|
|
207
|
+
```json
|
|
208
|
+
{
|
|
209
|
+
"strategy": "round-robin",
|
|
210
|
+
"models": {
|
|
211
|
+
"completions": ["azure-eastus/gpt-5", "azure-westus/gpt-5"]
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Fallback Model, with only a quota fallback, so failed requests stay on the two
|
|
217
|
+
deployments:
|
|
218
|
+
|
|
219
|
+
```json
|
|
220
|
+
{
|
|
221
|
+
"models": {
|
|
222
|
+
"completions": {
|
|
223
|
+
"quotaFallback": "openai/gpt-5-mini"
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Budgets and Costs blocks the app at $500 a month. Here's what happens to Chat
|
|
230
|
+
Completions requests:
|
|
231
|
+
|
|
232
|
+
| Situation | What the gateway does |
|
|
233
|
+
| ------------------------------------------------------- | ------------------------------------------------------------------------------ |
|
|
234
|
+
| The app is within budget | Sends each request to the next deployment in the rotation |
|
|
235
|
+
| `azure-eastus/gpt-5` returns `429` three times in a row | Moves the request to `azure-westus/gpt-5` |
|
|
236
|
+
| `azure-westus/gpt-5` returns `503` | Moves the request to `azure-eastus/gpt-5` |
|
|
237
|
+
| The app reaches $500 for the month | Sends requests to `openai/gpt-5-mini` |
|
|
238
|
+
| `openai/gpt-5-mini` returns `503` while over budget | Moves the request to the retry model from the list, so it still gets an answer |
|
|
239
|
+
|
|
240
|
+
To move failed requests to a model outside the list instead, give Fallback Model
|
|
241
|
+
a `fallback` too. It then replaces the list's retry model.
|
|
242
|
+
|
|
243
|
+
## Configure routing in the Portal
|
|
244
|
+
|
|
245
|
+
Open the [Apps](https://portal.zuplo.com/+/account/project/ai/apps) tab of your
|
|
246
|
+
AI Gateway project, select the app, and on its **Policies** tab click **Add
|
|
247
|
+
policy**:
|
|
248
|
+
|
|
249
|
+
- **Model Filtering** and **Fallback Model** have their own forms. Fallback
|
|
250
|
+
Model's form has **Failure fallback** and **Quota fallback** fields for
|
|
251
|
+
completions and embeddings, and a **Fallback timeout (seconds)** field.
|
|
252
|
+
- **Model Load Balancing** and **Smart Router** open a settings form built from
|
|
253
|
+
the policy's options, with a JSON view. For Smart Router, pick the classifier
|
|
254
|
+
app from the list of apps in the project.
|
|
255
|
+
|
|
256
|
+
Drag the entries into the order from [Put them in order](#put-them-in-order).
|
|
257
|
+
Chain changes apply without a deploy. To give every new app in a pool the same
|
|
258
|
+
routing, add the policies to the pool's
|
|
259
|
+
[policy template](./policy-templates.mdx).
|
|
260
|
+
|
|
261
|
+
The **Add policy** dialog lists the policies declared in your gateway's
|
|
262
|
+
`config/policies.json`. If you connected a Git repository and a routing policy
|
|
263
|
+
is missing from the list, see
|
|
264
|
+
[Keep the gateway up to date](./source-control.mdx#keep-the-gateway-up-to-date).
|
|
265
|
+
|
|
266
|
+
To pick models with your own logic, such as the cheapest active model, write a
|
|
267
|
+
custom policy. See
|
|
268
|
+
[Dynamic model routing](./cookbooks/dynamic-model-routing.mdx) and
|
|
269
|
+
[Custom fallback logic](./cookbooks/custom-fallback.mdx).
|
|
270
|
+
|
|
271
|
+
## Related resources
|
|
272
|
+
|
|
273
|
+
- [Fallback Models](./fallback.mdx): configure the backup and quota fallback
|
|
274
|
+
- [Usage Limits](./usage-limits.mdx): set the budgets that trigger a quota
|
|
275
|
+
fallback
|
|
276
|
+
- [Guardrails](./guardrails.mdx): inspect prompts and responses in the same
|
|
277
|
+
chain
|
|
@@ -53,6 +53,8 @@ Analytics lives in the **Observability** tab of the Zuplo Portal, alongside
|
|
|
53
53
|
invocations, JSON-RPC methods, upstream health.
|
|
54
54
|
- [GraphQL](./tabs/graphql.md): operation volume, errors, resolver latency,
|
|
55
55
|
and query complexity.
|
|
56
|
+
- [Cache](./tabs/cache.md): HTTP and semantic cache hit rates, lookup latency,
|
|
57
|
+
and tokens saved by semantic caching.
|
|
56
58
|
- Reference:
|
|
57
59
|
- [Metrics glossary](./reference/metrics-glossary.md): every KPI and
|
|
58
60
|
percentile defined once.
|
|
@@ -71,6 +73,7 @@ You'll see a subset of sections depending on your plan and project setup:
|
|
|
71
73
|
| Agents | All accounts. |
|
|
72
74
|
| MCP | The project type is **standard** and the project uses MCP. |
|
|
73
75
|
| GraphQL | The project proxies a GraphQL API. |
|
|
76
|
+
| Cache | All accounts. |
|
|
74
77
|
|
|
75
78
|
Analytics is included on every plan. If you don't see Analytics at all, your
|
|
76
79
|
account may have it disabled — see
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Cache"
|
|
3
|
+
sidebar_label: "Cache"
|
|
4
|
+
applies_to:
|
|
5
|
+
product: gateway
|
|
6
|
+
hosting: all
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
The **Cache** section reports every lookup that a caching policy makes: how
|
|
10
|
+
often the cache answers a request, how fast each lookup is, and, for AI Gateway
|
|
11
|
+
semantic caching, how many tokens the cache saved you. It covers both HTTP
|
|
12
|
+
caching with the [Caching policy](../../policies/caching-inbound.mdx) and
|
|
13
|
+
semantic caching with the
|
|
14
|
+
[Semantic Cache](../../policies/semantic-cache-inbound.mdx) and
|
|
15
|
+
[AI Gateway Semantic Cache](../../policies/ai-gateway-semantic-cache-inbound.mdx)
|
|
16
|
+
policies. It appears for every project and at account scope.
|
|
17
|
+
|
|
18
|
+
## When to use this
|
|
19
|
+
|
|
20
|
+
- Check how often each cache answers requests, by hit rate and by lookup volume.
|
|
21
|
+
- See how many LLM tokens semantic cache hits kept from reaching the provider.
|
|
22
|
+
- Compare HTTP and semantic caching, or one caching policy against another.
|
|
23
|
+
- Find the routes that hit the cache most, and the ones that rarely do.
|
|
24
|
+
|
|
25
|
+
## Summary KPIs
|
|
26
|
+
|
|
27
|
+
| Name | What it measures |
|
|
28
|
+
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
29
|
+
| **Hit Rate** | Hits ÷ (hits + misses) in the window. Shows a dash when there were no lookups. |
|
|
30
|
+
| **Hits** | Lookups the cache answered. |
|
|
31
|
+
| **Misses** | Lookups that went on to the backend or the model provider. |
|
|
32
|
+
| **Stores** | Responses written into the cache for later lookups. |
|
|
33
|
+
| **Saved Tokens** | Tokens that AI Gateway Semantic Cache hits kept from reaching the provider. Secondary: input · output split. These tokens add $0 to consumption. Appears when the window has at least one saved token. |
|
|
34
|
+
|
|
35
|
+
**Saved Tokens** comes from the token usage in each cached response, so it
|
|
36
|
+
counts hits on AI Gateway Semantic Cache. The general Semantic Cache policy can
|
|
37
|
+
cache any JSON route and doesn't report saved tokens.
|
|
38
|
+
|
|
39
|
+
## Charts
|
|
40
|
+
|
|
41
|
+
**Cache Lookups Over Time.** Hits and misses per interval.
|
|
42
|
+
|
|
43
|
+
**Lookup Latency.** P50, P95, and P99 cache lookup latency in the window.
|
|
44
|
+
|
|
45
|
+
**Cache Latency Over Time.** P50, P95, and P99 lookup latency per interval.
|
|
46
|
+
_What to look for:_ a rise in lookup latency adds to every request on the route,
|
|
47
|
+
hit or miss. Filter by cache type or policy to find which cache it comes from.
|
|
48
|
+
|
|
49
|
+
**Cache Types.** Lookup volume split between **HTTP** and **Semantic**, with a
|
|
50
|
+
**By Cache Type** table of hits, misses, and hit rate for each.
|
|
51
|
+
|
|
52
|
+
## Tables
|
|
53
|
+
|
|
54
|
+
**Policies.** One row per caching policy, by policy name.
|
|
55
|
+
|
|
56
|
+
| Column | Notes |
|
|
57
|
+
| -------- | ----------------------------------------------- |
|
|
58
|
+
| Policy | The policy name from your policy configuration. |
|
|
59
|
+
| Type | HTTP or Semantic. |
|
|
60
|
+
| Hits | Lookups the policy answered. |
|
|
61
|
+
| Misses | Lookups the policy passed on. |
|
|
62
|
+
| Hit Rate | Hits ÷ (hits + misses). |
|
|
63
|
+
|
|
64
|
+
**Top Routes.** The routes with the most cache hits, with the same **Hits**,
|
|
65
|
+
**Misses**, and **Hit Rate** columns.
|
|
66
|
+
|
|
67
|
+
Both tables sort on any column (default: hits descending). Click a cache type,
|
|
68
|
+
policy, or route to filter the whole section to it, and click it again to clear
|
|
69
|
+
the filter.
|
|
70
|
+
|
|
71
|
+
## Filters
|
|
72
|
+
|
|
73
|
+
The filter bar applies. See [Shared controls](../shared-controls.md#filters).
|
|
74
|
+
|
|
75
|
+
## Troubleshooting
|
|
76
|
+
|
|
77
|
+
**The section is empty.** No caching policy made a lookup in the selected
|
|
78
|
+
window. Add a caching policy to a route and send traffic through it. See
|
|
79
|
+
[Cache at the gateway](../../caching/gateway-caching.mdx).
|
|
80
|
+
|
|
81
|
+
**The Saved Tokens card is missing.** No AI Gateway Semantic Cache hit saved
|
|
82
|
+
tokens in the window. Hits on the general Semantic Cache policy and on the
|
|
83
|
+
Caching policy don't report tokens.
|
|
84
|
+
|
|
85
|
+
**The hit rate is low.** Each lookup that misses still has to reach the backend.
|
|
86
|
+
For HTTP caching, see how the cache key affects the hit rate in
|
|
87
|
+
[Shape the cache key with headers](../../caching/gateway-caching.mdx#shape-the-cache-key-with-headers).
|
|
88
|
+
For semantic caching, see
|
|
89
|
+
[Isolate semantic cache entries by tenant](../../caching/semantic-caching.mdx).
|
|
@@ -282,6 +282,29 @@ export default async function (request: ZuploRequest, context: ZuploContext) {
|
|
|
282
282
|
}
|
|
283
283
|
```
|
|
284
284
|
|
|
285
|
+
## Use the certificate with more than one ALB
|
|
286
|
+
|
|
287
|
+
You can present the same client certificate to several ALBs, for example one in
|
|
288
|
+
each AWS Region for disaster recovery, or separate ALBs for blue and green
|
|
289
|
+
backends. Zuplo presents the certificate to whichever ALB receives the request,
|
|
290
|
+
so each ALB needs:
|
|
291
|
+
|
|
292
|
+
- An HTTPS listener in **verify** mode, with a trust store that contains the CA
|
|
293
|
+
that issued Zuplo's client certificate. Trust stores belong to one AWS Region,
|
|
294
|
+
so create one in each Region with the same CA bundle.
|
|
295
|
+
- A server certificate that covers the hostname the gateway calls. When a global
|
|
296
|
+
service such as AWS Global Accelerator routes one hostname to ALBs in several
|
|
297
|
+
Regions, install a certificate for that hostname on every ALB. ACM
|
|
298
|
+
certificates belong to one Region, so request or import one in each Region.
|
|
299
|
+
|
|
300
|
+
The client certificate itself isn't installed on the ALBs. It stays in Zuplo,
|
|
301
|
+
and the ALBs only need the CA to verify it.
|
|
302
|
+
|
|
303
|
+
When you rotate the client certificate and the new one comes from a different
|
|
304
|
+
CA, add that CA to every ALB's trust store before Zuplo starts presenting the
|
|
305
|
+
new certificate. See
|
|
306
|
+
[Certificate Rotation](./securing-backend-mtls.mdx#certificate-rotation).
|
|
307
|
+
|
|
285
308
|
## Verify the connection
|
|
286
309
|
|
|
287
310
|
Deploy your changes to a preview or production environment, then send a request
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Deployments and Rollbacks
|
|
3
|
+
sidebar_label: Deployments and Rollbacks
|
|
4
|
+
description:
|
|
5
|
+
Zuplo deploys gateway changes without downtime and keeps serving the current
|
|
6
|
+
version when a deployment fails. Roll back to any earlier build from the
|
|
7
|
+
Portal.
|
|
8
|
+
tags:
|
|
9
|
+
- deployment
|
|
10
|
+
applies_to:
|
|
11
|
+
product: gateway
|
|
12
|
+
hosting: all
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
Every time you push to a branch, Zuplo builds that branch and deploys it to the
|
|
16
|
+
matching environment. Deployments don't cause downtime, a deployment that fails
|
|
17
|
+
never replaces the version that's serving, and you can roll back to any earlier
|
|
18
|
+
build from the Zuplo Portal.
|
|
19
|
+
|
|
20
|
+
For how branches map to environments, see
|
|
21
|
+
[Branch-Based Deployments](./branch-based-deployments.mdx).
|
|
22
|
+
|
|
23
|
+
## How a deployment rolls out
|
|
24
|
+
|
|
25
|
+
When a new version of your gateway deploys:
|
|
26
|
+
|
|
27
|
+
- **There's no downtime.** The environment keeps serving requests throughout the
|
|
28
|
+
deployment.
|
|
29
|
+
- **In-flight requests finish.** Requests that are already in progress complete
|
|
30
|
+
on the version that received them. New requests go to the new version.
|
|
31
|
+
- **Both versions can serve briefly.** Until the rollout reaches every location,
|
|
32
|
+
some requests can still reach the previous version. Keep changes backward
|
|
33
|
+
compatible across one release, for example by adding a new route before you
|
|
34
|
+
remove the old one.
|
|
35
|
+
|
|
36
|
+
A deployment takes a few minutes to reach every location that serves your
|
|
37
|
+
gateway.
|
|
38
|
+
|
|
39
|
+
## When a deployment fails
|
|
40
|
+
|
|
41
|
+
If a build or deployment fails, nothing rolls out. The environment keeps serving
|
|
42
|
+
the version that was already deployed, and you can fix the problem and push
|
|
43
|
+
again. To find out why a build failed, see
|
|
44
|
+
[Troubleshooting Deployments and Git Sync](./troubleshooting-deployments-and-git-sync.mdx).
|
|
45
|
+
|
|
46
|
+
The build catches problems such as invalid configuration files and code that
|
|
47
|
+
doesn't compile. It can't catch every problem that only shows up at runtime,
|
|
48
|
+
such as an environment variable that points to the wrong backend or a policy
|
|
49
|
+
that rejects valid requests. Test each deployment before it takes production
|
|
50
|
+
traffic, for example by running tests against a preview environment. See
|
|
51
|
+
[Testing Preview Environments](./testing-preview-environments.mdx).
|
|
52
|
+
|
|
53
|
+
## Roll back to an earlier version
|
|
54
|
+
|
|
55
|
+
You can redeploy any earlier build of an environment from the Zuplo Portal.
|
|
56
|
+
|
|
57
|
+
1. Open
|
|
58
|
+
[**Environments**](https://portal.zuplo.com/+/account/project/environments)
|
|
59
|
+
in your project.
|
|
60
|
+
2. Select the environment you want to roll back. Its list of builds opens.
|
|
61
|
+
3. Find the build you want to return to, open its actions menu, and select
|
|
62
|
+
**Redeploy this version**.
|
|
63
|
+
4. Review the dialog and select **Deploy**. For the production environment, the
|
|
64
|
+
button reads **Deploy to production**.
|
|
65
|
+
|
|
66
|
+
The redeploy rolls out the same way as any other deployment: with no downtime,
|
|
67
|
+
reaching every location within a few minutes.
|
|
68
|
+
|
|
69
|
+
:::caution
|
|
70
|
+
|
|
71
|
+
A redeploy uses the source code of the build you select, with your project's
|
|
72
|
+
current settings. If the problem came from an
|
|
73
|
+
[environment variable](./environment-variables.mdx), change the variable back as
|
|
74
|
+
well. Redeploying an earlier build doesn't restore its old variable values.
|
|
75
|
+
|
|
76
|
+
:::
|
|
77
|
+
|
|
78
|
+
### Keep your branch in sync
|
|
79
|
+
|
|
80
|
+
Redeploying an earlier build doesn't change your Git branch. The next push to
|
|
81
|
+
that branch deploys the branch's latest commit, including the change you rolled
|
|
82
|
+
back. After you roll back, revert the change in Git, for example with
|
|
83
|
+
`git revert`, so the next deployment doesn't reintroduce it.
|
|
84
|
+
|
|
85
|
+
You can also roll back through Git alone: revert the commit and push. Zuplo
|
|
86
|
+
builds and deploys the reverted branch like any other change.
|
|
87
|
+
|
|
88
|
+
## Related resources
|
|
89
|
+
|
|
90
|
+
- [Environments](./environments.mdx)
|
|
91
|
+
- [Branch-Based Deployments](./branch-based-deployments.mdx)
|
|
92
|
+
- [Source Control and Deployment](../concepts/source-control-and-deployment.mdx)
|
|
93
|
+
- [Blue-Green Deployments for Your Backend](../guides/blue-green-deployments.mdx)
|