# Limits & operations (/omen/limits)

> Run Omen in production: connection and filter limits, heartbeats, lag policy, HTTP/2 flow control, Resume retention and every refusal.



Omen has no plan RPS/TPS threshold and doesn't meter bandwidth. What it does limit is listed here, with the status or ack you get when you cross the line.

## Connections

| Limit                                     | Value                           | Over it                                                  |
| ----------------------------------------- | ------------------------------- | -------------------------------------------------------- |
| Concurrent connections per IP, per metro  | **50**                          | gRPC `RESOURCE_EXHAUSTED` (8), reason `connection_limit` |
| New connections per IP                    | **50 per second**, burst **70** | gRPC `RESOURCE_EXHAUSTED` (8), reason `rate_limit`       |
| `Subscribe` streams per connection        | **1**                           | gRPC `FAILED_PRECONDITION` (9) on the second             |
| Time to open `Subscribe` after connecting | **5 seconds**                   | The connection is closed                                 |
| Request compression                       | Identity only                   | gRPC `UNIMPLEMENTED` (12) for gzip or zstd               |

One stream per connection means one connection per stream. In `@grpc/grpc-js`, clients to the same host share a connection unless you set `'grpc.use_local_subchannel_pool': 1`.

## Filters and messages

| Limit                               | Value                                        | Over it                                                      |
| ----------------------------------- | -------------------------------------------- | ------------------------------------------------------------ |
| Subscriptions per connection        | **64** (`sub_id` 0–63)                       | `ACK_REASON_INVALID_SUB_ID` / `ACK_REASON_MAX_SUBS_PER_CONN` |
| Keys per subscription               | **100,000**                                  | `ACK_REASON_MAX_KEYS_PER_SUB`                                |
| Keys per connection                 | **200,000**                                  | `ACK_REASON_MAX_KEYS_PER_CONN`                               |
| Client message size                 | Normally up to **64 KiB** (about 1,900 keys) | See below                                                    |
| Cuckoo filter `data`                | **2 MiB**                                    | gRPC `INVALID_ARGUMENT` (3), stream closed                   |
| Cuckoo subscriptions per connection | **4**                                        | `ACK_REASON_CUCKOO_FILTER_LIMIT`                             |

A client message larger than 64 KiB (up to about 5.5 MB with a cuckoo filter) is admitted when the server has capacity for it. Otherwise the stream closes with gRPC `RESOURCE_EXHAUSTED` (8); that's transient, so retry with backoff. To stay under 64 KiB, split a big key list across several subscriptions, or send a cuckoo filter.

## Capacity-limited requests

Unfiltered firehose subscriptions and `Resume` replays share server capacity with everyone else. When it's short you get one of:

| Refusal                                       | For                                                                       |
| --------------------------------------------- | ------------------------------------------------------------------------- |
| `ACK_REASON_FILTER_TOO_BROAD`                 | A transaction subscription with no `account_include` and no cuckoo filter |
| `ACK_REASON_SERVER_RESOURCES`                 | Any subscription, when the server is short of resources                   |
| `StreamError` `ERROR_CODE_RESOURCE_EXHAUSTED` | A replay, or alongside a capacity ack refusal                             |

Each carries (or follows) a `retry_after_ms` between **0.5 and 5 seconds**. Wait at least that long before you retry. A filtered subscription is never refused as too broad.

## Heartbeats

* After **10 seconds** with no other frame, the server sends a `Heartbeat{slot}` carrying the newest slot it has observed.
* A `Ping{id}` from you is answered with `Pong{id}`; use it to measure round trip.
* The server closes a stream whose server side has been silent for **45 seconds**. Heartbeats prevent that while the server is healthy.

Set your own liveness deadline as a comfortable multiple of 10 s (for example 30 s): if nothing at all has arrived by then, drop the connection and reconnect with `Resume`.

## Lag

A reader that falls too far behind is handled by the connection's `OnLag` policy ([ConnectionConfig](/omen/api#unsubscribe-ping-connectionconfig)):

| Policy                   | Result                                                                                                                                 |
| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- |
| `ON_LAG_CLOSE` (default) | The stream closes with gRPC `DATA_LOSS` (15), message `lagged`. Reconnect with `Resume` from your last slot to pick up what you missed |
| `ON_LAG_SKIP_TO_LIVE`    | The stream jumps to the live head and sends a `GapNotice{from_seq, to_seq}`                                                            |
| `ON_LAG_CONFLATE`        | Slot statuses keep only the latest per slot; data subscriptions skip to live as above                                                  |

`SKIP_TO_LIVE` and `CONFLATE` are opt-in. Lag usually means the client isn't reading fast enough: read on a dedicated task, hand messages off to a queue, and keep your HTTP/2 window large.

## Flow control

`@grpc/grpc-js` starts every stream with a **64 KiB** HTTP/2 window, which can starve a high-rate stream. When the server sees your window holding it back, it sends the advisory `StreamError` `ERROR_CODE_FLOW_CONTROL_LIMITED`; the stream continues, but you'll fall behind. Raise the window:

<Tabs items={['Node.js (grpc-js)', 'Rust (tonic)', 'Go']}>
  <Tab value="Node.js (grpc-js)">
    ```javascript
    // Requires @grpc/grpc-js 1.13 or newer.
    const client = new omen.aRPC(host, grpc.credentials.createInsecure(), {
      'grpc-node.flow_control_window': 8 * 1024 * 1024,
    });
    ```
  </Tab>

  <Tab value="Rust (tonic)">
    ```rust
    let channel = Channel::from_static("http://omen.fra.corvus-labs.io:30303")
        .initial_stream_window_size(8u32 << 20)
        .initial_connection_window_size(8u32 << 20)
        .connect()
        .await?;
    ```
  </Tab>

  <Tab value="Go">
    ```go
    // grpc-go sizes its window dynamically by default; set these only if you
    // still see ERROR_CODE_FLOW_CONTROL_LIMITED.
    conn, err := grpc.NewClient("omen.fra.corvus-labs.io:30303",
    	grpc.WithTransportCredentials(insecure.NewCredentials()),
    	grpc.WithInitialWindowSize(8<<20),
    	grpc.WithInitialConnWindowSize(8<<20))
    ```
  </Tab>
</Tabs>

## Resume retention

`Resume{from_slot}` replays from a short window: about **two minutes** at full-chain volume. Older than that, you get `ERROR_CODE_OUT_OF_RANGE`; reconnect without `Resume` and backfill the gap through [Solana RPC](/solana-rpc). Resume as soon as you can after a disconnect, from the last slot you handled.

## conn\_seq

`conn_seq` rises by exactly 1 on every frame of a connection, control frames included. It never has a gap: if you observe one, it's a transport bug. Reconnect with `Resume` and tell us on [Discord](https://discord.gg/corvus-labs). It restarts with every connection.

`seq` is different: a global frame id with gaps on any filtered stream. Use it to de-duplicate, never to detect loss ([seq vs conn\_seq](/omen/api#seq-vs-conn_seq)).

## Refusals

Connection-level refusals arrive as a gRPC status on the stream. The `grpc-message` is JSON:

```json
{
  "reason": "permission_denied",
  "detail": "identity is not scoped to the requested service. Please contact support at discord.gg/corvus-labs"
}
```

It may also carry `retry_after_ms`; wait at least that long before you reconnect. Match on the status and `reason`, not the whole string.

| Situation                                                   | gRPC status                                            | `reason` / detail                                                                    | Before reconnecting                                                                                     |
| ----------------------------------------------------------- | ------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------- |
| Your IP isn't known in this metro                           | `UNAUTHENTICATED` (16)                                 | detail `no authenticated identity for connection`                                    | Register the IP your traffic actually leaves from                                                       |
| Known account, but no Omen access for this IP in this metro | `PERMISSION_DENIED` (7)                                | reason `permission_denied`, detail `identity is not scoped to the requested service` | Buy Omen for this metro and IP, or use a pass IP in a holder metro ([access](/omen#access-and-pricing)) |
| Over the per-IP connection cap                              | `RESOURCE_EXHAUSTED` (8)                               | reason `connection_limit`                                                            | Close connections you don't use                                                                         |
| Over the new-connection rate                                | `RESOURCE_EXHAUSTED` (8)                               | reason `rate_limit`                                                                  | Back off                                                                                                |
| Your order ended while streaming                            | Connection closes; the reconnect gets one of the above | —                                                                                    | Extend the order or turn on auto-renew                                                                  |
| No healthy backend                                          | `UNAVAILABLE` (14)                                     | —                                                                                    | Back off and retry                                                                                      |
| A second `Subscribe` on one connection                      | `FAILED_PRECONDITION` (9)                              | —                                                                                    | One connection per stream                                                                               |
| gzip or zstd request compression                            | `UNIMPLEMENTED` (12)                                   | —                                                                                    | Turn compression off                                                                                    |
| Reader too slow under `ON_LAG_CLOSE`                        | `DATA_LOSS` (15)                                       | message `lagged`                                                                     | Reconnect with `Resume`                                                                                 |
| Bad cuckoo `data`                                           | `INVALID_ARGUMENT` (3)                                 | —                                                                                    | Fix the filter                                                                                          |
| Oversized message with no capacity for it                   | `RESOURCE_EXHAUSTED` (8)                               | —                                                                                    | Retry with backoff                                                                                      |

Per-subscription refusals don't close the stream: they arrive as a `SubscribeAck` with `accepted = false` and an [`AckReason`](/omen/api#subscribeack).

## Pre-execution data

<Callout type="warn" title="Observation, not execution">
  Omen shows you what it saw on the network before any of it executed. `SLOT_STATUS_COMPLETE` only means the slot's last entry was observed: not confirmed, not rooted, not finalized. Confirm by signature through Solana RPC before you do anything irreversible.
</Callout>
