You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- `concurrency`: The number of concurrenct workers, default is 8.
80
83
- `request-merge-policy`: Currently only supporting <u>random-robin</u> policy.
81
-
- `message-queue-impl`: Implementation of the queueing system. Options are <u>gcp-pubsub</u>for GCP PubSub <u>redis-sortedset</u>for Redis Sorted Set (persisted and sorted) and <u>redis-pubsub</u>for ephemeral Redis-based implementation.
82
-
- `dispatch-gate`: Implementation of a dispatcher that is responsible for gating pulling messages from the queues. Options are :
83
-
- `noop`: The default. Represents full availability of the system. Always pulling messages.
84
-
- `metric-avg-queue-size`: Availability base on the model average queue size metric in Prometheus. If the queue size is non empty, messages will not be pulled from the respective queue.
85
-
- `redis`: Availability of the system is pulled periodically from Redis (I.e., managed by external system).
84
+
- `message-queue-impl`: Implementation of the queueing system. Options are <u>gcp-pubsub</u>for GCP PubSub, <u>gcp-pubsub-gated</u>for GCP PubSub with per-topic gating, <u>redis-sortedset</u>for Redis Sorted Set (persisted and sorted), and <u>redis-pubsub</u>for ephemeral Redis-based implementation.
85
+
86
+
- `prometheus-url`: Prometheus server URL for metric-based gates (e.g., http://localhost:9090). For Google Managed Prometheus (GMP), point this to a local proxy or GMP frontend that handles authentication — direct GMP URLs are not supported as the Async Processor does not perform GMP authentication.
87
+
This flag is required when using metric-based per-queue gates (e.g., `prometheus-saturation`).
86
88
87
89
<i>additional parameters may be specified for concrete message queue implementations</i>
88
90
91
+
## Dispatch Gates
92
+
93
+
The Async Processor supports dispatch gates to control batch processing based on system capacity. Gates can be configured per-queue (via configuration files).
94
+
95
+
### Per-Queue Dispatch Gates
96
+
97
+
For more fine-grained control, configure gates per queue in your configuration file. Each queue can have its own gate type and parameters.
- `redis`: Queries Redis for dispatch budget (managed by external system).
103
+
- `prometheus-saturation`: Queries Prometheus for pool saturation metric. Returns 1.0 - saturation if below threshold, 0.0 otherwise.
104
+
105
+
**Example Configuration with Per-Queue Gates:**
106
+
107
+
```json
108
+
[
109
+
{
110
+
"queue_name": "critical_queue",
111
+
"inference_objective": "critical-task",
112
+
"request_path_url": "/v1/inference",
113
+
"gate_type": "constant"
114
+
},
115
+
{
116
+
"queue_name": "batch_queue",
117
+
"inference_objective": "batch-task",
118
+
"request_path_url": "/v1/inference",
119
+
"gate_type": "prometheus-saturation",
120
+
"gate_params": {
121
+
"pool": "inference_pool_1",
122
+
"threshold": "0.8"
123
+
}
124
+
},
125
+
{
126
+
"queue_name": "redis_gated_queue",
127
+
"inference_objective": "gated-task",
128
+
"request_path_url": "/v1/inference",
129
+
"gate_type": "redis",
130
+
"gate_params": {
131
+
"address": "localhost:6379",
132
+
"budget_key": "my-budget-key"
133
+
}
134
+
}
135
+
]
136
+
```
137
+
138
+
**Gate Parameters:**
139
+
140
+
- `redis`:
141
+
- `address` (**required**): Redis server address for the dispatch gate (e.g., `localhost:6379`). Queues sharing the same address will share the same connection pool.
142
+
- `budget_key` (optional): Redis key to read dispatch budget from. Default is `dispatch-gate-budget`.
143
+
144
+
- `prometheus-saturation`:
145
+
- `pool`: The inference pool name to query metrics for.
146
+
- `threshold`: Saturation threshold (0.0-1.0). When saturation >= threshold, budget is 0.0. Default is 0.8.
147
+
- `fallback`: Fallback saturation value (0.0-1.0) used when the metric source returns an error or empty data. Default is 0.0.
148
+
- `query`: Custom PromQL expression to query. If omitted, a default query using `inference_extension_flow_control_pool_saturation` with the `pool` label is used.
89
149
90
-
## Request Messages and Consusmption
150
+
## Request Messages and Consumption
91
151
92
152
The async processor expects request messages to have the following format:
153
+
93
154
```json
94
155
{
95
156
"id":"unique identifier for result mapping",
@@ -100,6 +161,7 @@ The async processor expects request messages to have the following format:
100
161
```
101
162
102
163
Example:
164
+
103
165
```json
104
166
{
105
167
"id":"19933123533434",
@@ -141,7 +203,6 @@ A persisted implementation based on Redis SortedSets.
- `redis.ss.addr`: Address of the Redis server. Default is <u>localhost:6379</u>.
147
208
- `redis.ss.igw-base-url`: Base URL of the IGW (e.g. https://localhost:30800).<br> Mutually exclusive with `redis.ss.queues-config-file` flag.
@@ -152,6 +213,8 @@ A persisted implementation based on Redis SortedSets.
152
213
- `redis.ss.queues-config-file`: The configuration file name when using multiple queues. <br> Mutually exclusive with `redis.ss.igw-base-url`, `redis.ss.request-queue-name`, `redis.ss.request-path-url` and `redis.ss.inference-objective` flags.
153
214
- `redis.ss.poll-interval-ms`: Poll interval in milliseconds. Default is <u>1000</u>.
154
215
- `redis.ss.batch-size`: Number of messages to process per poll. Default is <u>10</u>.
216
+
- `redis.ss.gate-type`: Gate type for single-queue mode (e.g., `redis`, `prometheus-saturation`). Only used when `redis.ss.queues-config-file` is not set.
217
+
- `redis.ss.gate-params`: JSON-encoded gate params map for single-queue mode (e.g., `{"address":"localhost:6379"}`). Only used when `redis.ss.queues-config-file` is not set.
155
218
156
219
### Redis Channels (Ephemeral)
157
220
@@ -182,19 +245,31 @@ An example implementation based on Redis channels is provided.
182
245
183
246
The configuration file when using the `redis.queues-config-file` flag should have the following format:
<u>Note:</u> The ephemeral Redis Channels implementation does not support per-queue dispatch gates. Use the [Redis Sorted Set](#redis-sorted-set-persisted) implementation for per-queue gating.
197
266
267
+
**Configuration Fields:**
268
+
269
+
- `queue_name`: The name of the Redis channel for this queue.
270
+
- `igw_base_url`: Base URL of the IGW.
271
+
- `inference_objective`: The inference objective header value.
272
+
- `request_path_url`: The request path URL.
198
273
199
274
### GCP Pub/Sub
200
275
@@ -218,28 +293,49 @@ The GCP PubSub implementation requires the user to configure the following:
218
293
- `pubsub.inference-objective`: InferenceObjective to use for requests (set as the HTTP header x-gateway-inference-objective if not empty). <br> Mutually exclusive with `pubsub.topics-config-file` flag.
219
294
- `pubsub.request-subscriber-id`: The subscriber ID for the requests topic.<br> Mutually exclusive with `pubsub.topics-config-file` flag.
220
295
- `pubsub.result-topic-id`: The results topic ID.
296
+
- `pubsub.batch-size`: Number of inflight messages. Default is <u>10</u>.
221
297
- `pubsub.topics-config-file`: The configuration file name when using multiple topics. <br> Mutually exclusive with `pubsub.request-subscriber-id`, `pubsub.request-path-url` and `pubsub.inference-objective` flags.
222
298
223
299
#### Multiple Topics Configuration File Syntax
224
300
225
301
The configuration file when using the `pubsub.topics-config-file` flag should have the following format:
0 commit comments