More

Limits

This page documents the limits for Rivet Actors.

There are two types of limits:

  • Soft Limit: Application-level limit, configurable in RivetKit. These cannot exceed the hard limit.
  • Hard Limit: Infrastructure-level limit that cannot be configured.

Soft limits can be configured in RivetKit by passing options to setup:

import { setup } from "rivetkit";

const rivet = setup({
  use: { /* ... */ },
  maxIncomingMessageSize: 1_048_576,
  maxOutgoingMessageSize: 10_485_760,
  // ...
});
TypeScript

Limits

WebSocket

These limits affect actions that use .connect() and low-level WebSockets.

NameSoft LimitHard LimitDescription
Max incoming message size64 KB32 MiBMaximum size of incoming WebSocket messages. Soft limit configurable via maxIncomingMessageSize.
Max outgoing message size1 MB32 MiBMaximum size of outgoing WebSocket messages. Soft limit configurable via maxOutgoingMessageSize.
WebSocket open timeout15 secondsTime allowed for WebSocket connection to be established, including onBeforeConnect and createConnState hooks. Connection is closed if exceeded.
Message ack timeout30 secondsTime allowed for message acknowledgment before connection is closed. Only relevant in the case of a network issue and does not affect your application.

Hibernating WebSocket

Hibernating WebSockets allow actors to sleep while keeping client connections alive. All WebSocket limits above also apply to hibernating WebSockets. See WebSocket Hibernation for details.

NameSoft LimitHard LimitDescription
Max pending buffer size128 MiBTotal size of all buffered messages per connection while actor is sleeping.
Max pending message count65,535Maximum number of buffered messages per connection while actor is sleeping.
Hibernation timeout90 secondsMaximum time an actor has to wake up before the client is disconnected. Only relevant if something is wrong with starting actors.

HTTP

These limits affect actions that do not use .connect() and low-level HTTP requests.

NameSoft LimitHard LimitDescription
Max request body size128 MiBMaximum size of HTTP request bodies.
Max response body size128 MiBMaximum size of HTTP response bodies.
Request timeout5 minutesMaximum time for a request to complete.

Networking

NameSoft LimitHard LimitDescription
Connection ping timeout30 secondsConnection is closed if a ping is not acknowledged within this time. Applies to both HTTP and WebSocket. Only relevant in the case of a network issue and does not affect your application.

Actor KV Storage

These limits apply to the low-level KV storage interface powering Rivet Actors. They likely do not affect your application, but are documented for completeness.

NameSoft LimitHard LimitDescription
Max key size2 KBMaximum size of a single key.
Max value size128 KBMaximum size of a single value.
Max keys per operation128Maximum number of keys in a single get/put/delete operation.
Max batch put payload size976 KBMaximum total size of all key-value pairs in a single batch put operation.
Max storage size per actor1 GiBMaximum total storage size for a single actor.
List default limit16,384Default maximum number of keys returned by a list operation.

Actor Input

See Actor Input for details.

NameSoft LimitHard LimitDescription
Max actor input size4 MiBMaximum size of the input passed when creating an actor.
Max connection params size4 KBMaximum size of connection parameters passed when connecting to an actor.
Max actor key size128 bytesMaximum size of an actor key (used for actor addressing).

Rate Limiting

NameSoft LimitHard LimitDescription
Rate limit1200 requests/minuteDefault rate limit per actor per IP address with a 1 minute time bucket.
Max in-flight requests32Default maximum concurrent requests to an actor per IP address.

Timeouts

NameSoft LimitHard LimitDescription
Action timeout60 secondsTimeout for RPC actions. Configurable via actionTimeout.
Create vars timeout5 secondsTimeout for createVars hook. Configurable via createVarsTimeout.
Create conn state timeout5 secondsTimeout for createConnState hook. Configurable via createConnStateTimeout.
On connect timeout5 secondsTimeout for onConnect hook. Configurable via onConnectTimeout.
On sleep timeout5 secondsTimeout for onSleep hook. Configurable via onSleepTimeout.
On destroy timeout5 secondsTimeout for onDestroy hook. Configurable via onDestroyTimeout.
Wait until timeout15 secondsMax time to wait for waitUntil background promises during shutdown. Configurable via waitUntilTimeout.

Increasing Limits

These limits are sane defaults designed to protect your application from exploits and accidental runaway bugs. If you have a use case that requires different limits, contact us to discuss your requirements.

Suggest changes to this page