Skip to content

beryl/overload

Admission limits for local beryl work.

Counts include queued and executing work. Accounted payload bytes are not a measurement of BEAM heap memory. Typed messages, closures, application state, raw PubSub delivery, and transport buffers are outside byte limits.

pub type AdmissionError {
Unavailable
Closed
Overloaded(boundary: Boundary)
ItemTooLarge(boundary: Boundary)
}

Work was not admitted, or a callback's complete result was rejected.

pub type Boundary {
RouterQueue
SocketQueue
WorkerQueue
PresenceQueue
CallbackBatch
}

A local admission boundary. These values are also telemetry labels.

pub type CallError {
AdmissionRejected(AdmissionError)
RequestTimedOut
OwnerUnavailable
}

A bounded request failed before admission or while awaiting completion.

RequestTimedOut

A timeout does not prove that the operation was not applied.

pub type LimitError {
InvalidItemLimit
InvalidByteLimit
}

A queue limit must be positive.

pub type Limits

Positive count and accounted-payload limits.

pub type Occupancy {
Occupancy(
boundary: Boundary,
items: Int,
bytes: Int,
max_items: Int,
max_bytes: Int,
high_items: Int,
high_bytes: Int,
rejected: Int,
cancelled: Int,
oldest_age_ms: Int
)
}

Owner-independent accounting. Bytes exclude opaque function environments. cancelled counts removed pending work and reclaimed abandoned reservations. Age is in milliseconds.

pub fn describe(AdmissionError) -> String

Describe an admission failure without including application data.

pub fn limits(
items: Int,
bytes: Int
) -> Result(Limits, LimitError)

Construct finite limits. Zero does not disable queue admission.

pub fn max_bytes(Limits) -> Int

Maximum accounted payload bytes.

pub fn max_items(Limits) -> Int

Maximum outstanding items.

pub fn shared_limits() -> Limits

Default router or presence mutation limits.

pub fn socket_limits() -> Limits

Default socket limits, including suspended work and pending reports.

pub fn worker_limits() -> Limits

Default topic-worker input limits.