Operations
Everything you need to run an app's ck-exec code: its logs, what is running and where, its versions and a rollback, a kill switch, calls per endpoint, the call limit, what it costs, a developer connection for tools and admin endpoints, and a connection for your organization's own game servers.
Reads need the org's view_compute_diagnostics permission. Changes and developer connections
need manage_compute. None of them take an app token: use your own session.
Logs
A hub or spoke logs with ctx.log:
ctx.log(Level::Warn, &format!("wave {} took {} ms", self.wave, took));
execLogs returns the app's lines, newest first:
query {
execLogs(appId: "…", nodeType: "arena", maxLevel: 1, limit: 50) {
id
nodeType
key
level
host
at
flow
text
}
}
| Argument | Meaning |
|---|---|
nodeType, key | Only one type, or one instance. |
maxLevel | The least severe level included: 0 errors only, 1 warnings too, 2 info, 3 everything (the default). |
before | A line id: only older lines. Pass the oldest id you have to page back. |
limit | At most this many lines, default 100 and at most 500. |
flow | Only the lines of one flow (below). |
Following one call
Every line logged while a handler runs carries the flow of the call it was handling, as 32
hex digits. A player's call and everything it causes share one flow: the calls it makes to
other hubs, on any host, and the lines those log. So execLogs(appId: "…", flow: "…") shows
what one call did across the whole tree, in place of the legacy gameModelFlow. Lines written
outside a call (start, snapshot, stop) have no flow.
Lines are kept for 24 hours, within these limits:
- Per call: a handler call logs at most 32 lines, and each line is cut to 1 KiB.
- Per host: each execution host keeps 50 lines a second per app, in bursts of up to 200.
- Per app: at most 200 lines a second and 100,000 a day, across hosts.
When a host drops lines over its rate, the log gets one warning line saying how many.
Instances and versions
execInstances(appId) lists what the platform has placed for the app:
| Field | Meaning |
|---|---|
nodeType, key | Which instance it is. |
kind | hub or spoke. |
phase | idle, starting, running or stopping. |
host | The host it runs on. |
epoch | Rises each time it's placed. |
sinceMs | How long it has been in this phase. |
heldBack | Why it isn't being placed right now, when it isn't. Either it crashed five times within a minute, and is placed again as those crashes age out, or its last start failed, and it's retried after 5 seconds. |
orphaned | True when the active version doesn't deploy its node type: a deploy or a rollback dropped the type and stopped the instance, which keeps its saved state (see below). Null from a manager older than ck-exec 0.19. |
execVersions(appId) lists every deploy, newest first, and marks the active one. Its
manifestJson is that version's manifest: each node type's kind, parent, client access, calls,
scopes and limits, with a spawn seed shown as its size (seed_bytes).
execActivateVersion(appId, version) makes an earlier one active again, which is a rollback.
Running instances of the types it keeps pick it up when they next start, just as they do after a
deploy. A hub stops when it has been idle for its eviction window or the app has been empty that
long, and one whose timer is pending doesn't go idle while players are in, so a deploy alone can
leave hubs on the old version for a long time. To move a type's running instances now (ck-exec
0.15), restart it:
mutation {
execRestartType(appId: "…", nodeType: "arena") {
stopped
}
}
Each running instance of the type persists and stops, without the type being switched off, and
its next call starts it on the active version from its snapshot. stopped counts the instances
told to stop. It needs manage_compute on the app's organization.
A deploy or a rollback that drops a type stops that type's running instances at once (ck-exec
0.19), timers or not: each is persisted and stopped as a restart would do, so code you no
longer deploy holds none of your app's instance or memory limit. There is nothing left to
restart, and execRestartType answers NOT_FOUND for a type the active version doesn't have.
Calls to the type then get NotFound. execInstances keeps listing those instances with
orphaned: true. A hub that has a snapshot keeps that snapshot and its instance row; a hub
snapshot has no expiry. So a later version that deploys a type of the same name starts its hubs
from what they saved. While such a snapshot exists, no deleted player's erasure in the app can
complete, because no code can be asked what the snapshot holds: read
before you drop a node type. The 10-minute forget applies only to a stopped instance with no snapshot,
which is how a spoke's replicas go away.
The kill switch
mutation {
execSetEnabled(appId: "…", nodeType: "mobs", enabled: false) {
activeVersion
disabled
disabledTypes
budgetPaused
}
}
Without nodeType, the whole app is switched off. While a type is off:
- nothing of it is placed;
- running instances are persisted and stopped;
- calls to it are refused with
Denied.
With the whole app off, players aren't given a host at all. Switch it on again and instances
start as they're called. execAppStatus(appId) shows the switches.
A type's switch lasts as long as the active version deploys the type. A deploy or a rollback
that drops a switched-off type drops its switch too (ck-exec 0.19), so disabledTypes only ever
names types of the active version. A later version that deploys a type of that name starts it
switched on.
Calls per endpoint
execEndpointStats counts the calls to each endpoint (a node type's method) over the last
minutes, most called first:
query {
execEndpointStats(appId: "…", nodeType: "arena", sinceMinutes: 60) {
nodeType
method
calls
appErrors
busy
denied
deadlineExceeded
otherErrors
latencyMsAvg
latencyMsMax
}
}
- A player's or an instance's call is counted once, by the host it entered on, with the status its caller got. Its latency runs from reaching that host to the answer leaving it: queueing, the handler, and any hop to the host that runs the target.
- Platform events (
$timer,$topic,$presence,$session,$world) are counted by the host that ran them, with the time in the handler. - Each host reports a minute once it ends, and counters are kept 7 days (
sinceMinutesat most 10,080). A host counts at most 256 endpoints per app a minute; the rest share one(other)row.
Call limits
A player may make 120 calls per 10 seconds to an app on one execution host, the legacy
invoke limit. Subscribing and unsubscribing count against it too. A call (or subscription) over
it is refused with Busy, and its message starts rate limited and says how long to wait. A
developer connection shares its user's limit. Calls between instances don't count; they have the
router's own limits.
The limit is kept per host, so a player connected to hubs on two hosts has 120 on each. Refused
calls show up as busy in the counters above; refused subscriptions do not.
Since ck-exec 0.10.0 the host also holds each connection to a few more limits:
pinghas its own allowance, 60 per 10 seconds; a ping over it gets no answer. A WebSocket ping (the protocol's control frame, which the host answers itself) over that allowance closes the connection instead.- A connection holds at most 256 subscriptions at once; the next is refused
Denied. - A message larger than 4 MiB and 64 KiB (a payload as large as an instance may send, with its address and method) closes the connection, and so does a text message: the protocol is binary.
- A player's or a developer's connection may have at most 16 MiB of answers and pushes queued for it (ck-exec 0.26.0), as well as 1,024 messages. A connection that falls further behind than that is closed. Read what you are sent, and connect again with a new token.
- Before a token is checked, a host takes at most 60 connections per 10 seconds from one address (an IPv4 address, or an IPv6 /64); more are closed as they arrive. A load test that opens more connections than that from one machine needs hosts configured for it.
Since ck-exec 0.11 two more limits keep one player from filling what everyone shares:
- Sessions. A player (or a developer connection, under its user) holds at most 16
connections to one app through a host at once. The 17th is answered
HTTP 429with the reason before any socket opens, and so is a connection to a host that is full. A browser cannot read that answer and reportsUnavailable; CrowdyJS in Node (with thewspackage) and CrowdyCPP reportUnavailablewith the reason. Close the connections a game no longer uses. - Instances. Each app has an instance limit and a memory limit per datacenter, set by its
organization's funding (ck-exec 0.15). An organization that cannot be charged (no spendable
wallet balance, no auto-billing) gets 16 instances reserving at most 1,024 MB per datacenter for
all of its apps together (ck-exec 0.22; until then, for each app); one that can be charged
gets 16,384 instances and 65,536 MB for each app. Crowded Kingdoms can set a different limit
for one organization (Application API 2.88): write to us when a game needs more, with the
instances and the memory it needs, and
orgComputeCeiling(orgId)shows what your organization has and whether it was set for you. What your organization can change has the address and what to send. We bill reserved memory by the GB-hour, so a higher limit raises what an app can cost: 4,096 hubs of 16 MB reserve 65,536 MB, which is $1.20 an hour past the free 730 GB-hours a month. An instance reserves its type's memory limit times its concurrency, and mods count too.execAppStatusreports the organization's shared limit and what its apps hold (orgMaxInstances,orgInstances,orgMaxReservedMb,orgReservedMb). Past either limit nothing new of the app is placed until some stop, whoever asks: a call to a hub key that is not running is answeredUnavailablewith a message naming the limit, andexecConnectwith anodeTypeandkeythat would place one fails. Running instances are never stopped for it. When a hub's own start fails, the answer isUnavailablewithstart failed: app N, type T, key K:and the reason (ck-exec 0.26.0; before, the reason alone). The key is cut at 64 bytes. Within that, one player's own calls hold at most 64 instances of the app at once (ck-exec 0.17): hubs their calls or subscriptions place at new keys, or anexecConnectplacing one beside them. Past it nothing more starts for that player,Unavailablenaming the bound, while every other player still places; the root hub, spoke replicas and what your own instances place count against nobody. A stopped instance that holds no snapshot is forgotten after 10 minutes, so the next call to its key places it under a new instance id. An idle instance stops after itsevict_after_ms(5 minutes by default), so keep the keys a game creates bounded, for example one hub per match rather than per action; small per-player hubs (a type may declare 1 to 512 MB) fit far more instances into the same memory.
Neither SDK retries a Busy call for you. CrowdyJS marks this refusal on the error
(CrowdyExecError.rateLimited, with the wait in retryAfterMs), and CrowdyCPP on the reply
(ExecReply::rateLimited(), retryAfterMs()), so a game can tell it from a full mailbox and
wait as long as the message says. From CrowdyJS 18.41.0, CrowdyCPP 0.95.0, and CrowdyPy 0.41.0
(CrowdyExecError.retry_after_ms) that wait is 30 seconds at most.
Usage and budgets
ck-exec code is metered per minute and billed in compute units, like the WASM engines it replaces: the greater of the CPU time and the fuel a minute used. Realtime events count as replication egress.
An app's code is paused (budgetPaused) in two cases:
- its last settled minute was over an enforced per-minute compute budget (
setAppComputeBudgetwithenforce: true); - the app's runtime status is not active, for example because the account ran out of funds.
A paused app is switched off entirely, as above, and a refused call names the cause: "app 456 is paused: its organization has no funds (insufficient_funds)", "... it reached its spend cap (spend_cap)", "... its organization has not added a payment method (payment_method_required)", or "... it is over its compute budget". It resumes by itself the minute after both conditions clear.
What hubs write when they save their state is billed as compute-module writes, and an organization's monthly free quota, shared by its apps, includes 3 GB of them, enough for a small game's hubs to run unfunded (free tier). A hub saves on every persist interval, but a save identical to the one stored last is neither stored nor billed again, so an idle hub's state costs nothing more.
Reserved memory is billed by the GB-hour: what each instance reserves, held for as long as
it runs, whatever it uses. A hub reserves its type's memory_mb (64 by default), a spoke that
times its copies (16 by default), so a spoke at the defaults reserves 1 GiB, and a player's mod
32 MiB. An idle instance keeps its reservation until its evict_after_ms stops it (5 minutes by
default). An organization's monthly free quota includes 730 GB-hours of it for all its apps
together, 1 GB held all month; a four-player Game Kit starter, about 576 MiB, stays inside it. To
reserve less, give small hubs a smaller memory_mb and keep spokes' concurrency to what they
need. An app that was already reserving memory in the month the rate was posted keeps it free
until that month ends.
Players' mods are not in the app's usage or budget: each bills its owner's player wallet, and billing switches off only that owner's mods; see who pays for a mod. The memory a mod reserves is the exception: it counts toward the app's organization, like the app's own instances.
Developer connections
execConnectAsDeveloper returns a gateway and a connect token for you, not a player:
mutation {
execConnectAsDeveloper(appId: "…", nodeType: "arena", key: "m1") {
gatewayUrl
token
host
expiresAt
}
}
Calls on that connection arrive as Caller::Developer(your user id). They may reach any node
type, not only client ones, so a tool can call admin endpoints, run a job by hand, or inspect
a hub. They can never reach the platform's $ methods, and subscribing doesn't count as a
player session. Guard an admin endpoint with call.developer():
"reset_wave" => {
let by = call.developer()?; // refuses players and other instances
ctx.log(Level::Info, &format!("wave reset by developer {by}"));
self.wave = 0;
encode(&true)
}
A module built with an older ckx-sdk (guest ABI 3 or earlier) refuses developer calls. Rebuild
it with the current SDK first.
Your organization's game servers
execConnectAsServer returns a gateway and a connect token for your organization's own game
server, the process that runs the game your players play. It takes an org token with the
scope fleet:session and is called from that server: see
fleet sessions.
It needs ck-exec 0.25.0, and a hub takes a server's calls once it is built with ckx-sdk
0.15.0 (guest ABI 6). An app that
requires the player's pass needs ck-exec 0.27.0.
mutation {
execConnectAsServer(appId: "…", nodeType: "world", key: "") {
gatewayUrl
token
host
expiresAt
}
}
Open one WebSocket for each game server, as a player's game does after execConnect. The
token lasts 60 seconds and opens one socket, so ask again at each reconnect. It travels in the
WebSocket URL's query string, as a player's does: do not log the answer or that URL. The connection may
call and subscribe to any node type of the app, as a developer connection may. It can never
reach the platform's $ methods, and subscribing doesn't count as a player session. A hub that
a server's call places counts toward no player's 64 instances. The host closes the connection
with code 4403 when the org token that asked for it is revoked or expires, and when fleet
sessions or org-managed players are switched off for your organization. From Application API
v2.90.0 it also closes at once when the app is archived, and when your organization is frozen
or closed.
A server calls for itself or for a player
A plain call (0x01) on a server connection is the server's own. The call-as frame makes a
call for one player:
| Frame | Direction | Layout |
|---|---|---|
| call-as | client → host | 0x05 rid u32, player u64, type str8, key str16, method str8, payload |
player is the player's user id, which FLEET_CARRY_RESULT carries for each player a
fleet session carries, and which mintManagedPlayerToken
answers as userId (Application API v2.90.0). Naming player 0 is the server's own
call. A host accepts 0x05 only on a server connection: on a player's or a developer's
connection it is an unknown frame, and the host closes the connection.
A hub decides what a server may do
A server's calls arrive as Caller::Org { player }: None for the server's own call and
Some(p) for a call-as. The platform checked that the connection belongs to the app's
organization. By default it did not check the player: the organization vouches for who its
players are, so p may be any id. Caller::Org { player: Some(p) } means "this organization's
server says player p", and Caller::Player(p) means "the platform saw p's own session".
An app can require the player's pass, and the
platform then checks p as well.
// From the player's own session only: an organization's server is refused.
"trade" => { let p = call.player()?; /* … */ }
// From the player, or from your organization's server acting for the player.
"report_position" => { let p = call.player_or_org()?; /* … */ }
// From your organization's servers only. `for_player` is None for the server itself.
"tick" => { let for_player = call.org()?; /* … */ }
- A module built for guest ABI 5 or earlier answers a server's call
Denied, and the handler does not run. Build it again with the SDK version above. - The platform never presents a server's call as a verified player's. No
$sessionevent is sent for a server's subscription, a server's call spends none of a player's call budget, and a hub it places counts toward no player's instances. ckx_sdk::testingdrives a hub asCaller::Org { player: None }orCaller::Org { player: Some(p) }, like any other caller.
An app can require the player's pass
By default a host takes your server's word for the player a call-as names. That fits the players your organization signs in itself, because your organization can already sign any of them in. Where people play with their own Crowded Kingdoms accounts, whoever holds your org token could make hub calls as any of them. For such an app you can require the player's pass.
A pass is a token, signed by Crowded Kingdoms, that says this player is signed in to this app. The hosts check it. A pass signs nobody in and opens no connection. It expires when the app token it came with expires, 30 minutes at most.
Passes need Application API v2.96.0 and ck-exec 0.27.0. Both are on every environment since December 2, 2026.
Your server gets a player's pass from the Application API in one of two ways:
- With the player's app token. Every answer that carries an app token carries the pass in
playerPass:mintAppToken,mintManagedPlayerToken,exchangeManagedPlayerAssertion,exchangePortalCode,signInWithMinecraft, andrefreshAppToken. A server that signs the player in, or refreshes the player's token, reads the pass from that answer. - For a token it already holds. The query
playerPass, sent with the player's app token as the bearer, answers{ pass, expiresAt }for that token. A session token is refused withAPP_TOKEN_REQUIREDand an org token withORG_TOKEN_NOT_ALLOWED.
The server then shows the pass on its hub connection with the vouch frame, once for each player:
| Frame | Direction | Layout |
|---|---|---|
| vouch | client → host | 0x06 rid u32, player u64, pass str16 |
player is the player's user id, as in a call-as, and pass is that player's pass, at most
2,048 bytes. The host answers with a reply to rid: Ok with an empty payload when it takes
the pass, or Denied when it does not. A host accepts 0x06 only on a server connection: on
a player's or a developer's connection it is an unknown frame, and the host closes the
connection. A host also closes a connection that sends a longer pass.
Two refusals carry a code at the start of the reply's message. Both have the status
Denied. Match the code and its colon, because the words after them can change.
| Message starts | Answers | When | What your server does |
|---|---|---|---|
PASS_REQUIRED: | A call-as | The app requires a pass, and the connection holds no live pass for the player. No handler ran. | Vouch for the player, then send the call again. |
PASS_INVALID: | A vouch | The pass expired, or it is for another player, another app, or another organization, or it is not a pass. | Get a new pass for the player, then vouch again. |
The requirement is a setting of the app, off by default.
setExecCallAsPolicy
sets it and
execCallAsPolicy(appId)
reads it. Both take the session of a member who holds manage_apps on the app. An org token
and an app token are refused, so a server's credential cannot switch the requirement off.
mutation {
setExecCallAsPolicy(input: { appId: "…", requiresPass: true }) {
appId
requiresPass
}
}
- Turn the requirement on last, after your servers vouch. From then on, a call for a player without a pass is refused.
- A change takes effect within about a minute, with no deploy of the app.
- With the setting off, nothing changes. A host takes a vouch, and a call-as passes with or without one.
- A pass belongs to the connection it was shown on. Vouch again for each player after a reconnect. Each of your servers vouches on its own connection, and one pass is good on any of them until it expires.
- Vouch again after each refresh of the player's token, with the pass that refresh
answered. A later vouch for the same player replaces the earlier one. Once a pass has
expired, a call for its player is refused with
PASS_REQUIREDuntil the server vouches with a newer pass. - The server's own calls need no pass. A plain call, and a call-as that names player 0, are made for no player.
- Vouch only where passes are checked. A host before ck-exec 0.27.0 closes a connection
that sends frame
0x06. The setting can be turned on only where the hosts check passes: elsewheresetExecCallAsPolicywithrequiresPass: trueanswersFEATURE_DISABLEDand changes nothing. - An app with no hubs deployed answers
NOT_FOUNDtosetExecCallAsPolicy, andexecCallAsPolicyreads false for it. - A vouch counts as 4 calls of the connection's call budget.
- A hub needs no change. The guest ABI stays 6 and
Calleris the same. When its app requires a pass, a hub that takesCaller::Org { player: Some(p) }can rely onp: the Application API saw that player signed in to the app, no longer ago than an app token lasts. - A pass is a credential. Keep it on your servers and out of your logs.
Not in this release. A sign-out does not end a pass before its expiry. A pass stays good until it expires, 30 minutes at most, also after the player signs out or loses access to the app. A server that holds the pass can make calls for that player until then. The Application API issues no new pass for a token that has ended.
A server connection has its own limits
| Limit | Value |
|---|---|
| Calls on one server connection | 2,000 a second. A message costs 1, and 1 more for each further 4 KiB. A vouch costs 4 (ck-exec 0.27.0) |
| Calls on all of an organization's server connections to one app through one host | 32,000 a second |
| Server connections an organization holds to one app through one host | 256 |
| Subscriptions on a connection, pings, and the largest message | As for a player's connection: 256, 60 per 10 seconds, and 4 MiB and 64 KiB |
| Answers and pushes queued for one server connection | 16,384 messages and 16 MiB. Past either, the connection is closed |
| Answers and pushes queued for all of an organization's server connections to one app through one host (ck-exec 0.26.0) | 256 MiB in total. Past it, the connection that is furthest behind is closed |
These take the place of a player's 120 calls per 10 seconds and 16 connections. Subscribing
and unsubscribing count as calls. A call past either budget is refused Busy before the
handler runs: its message starts rate limited, names the limit it reached, and says how long
to wait.
A server that reads what it is sent stays far inside the queue limits: an answer or a push is
at most 4 MiB. A connection closed for its queue connects again with a new token from
execConnectAsServer, and what was queued for it is dropped.
From an SDK
CrowdyJS client.exec | CrowdyCPP client.exec() |
|---|---|
logs(appId, { nodeType, key, maxLevel, flow, before, limit }) | logs(appId, ExecLogsQuery) |
endpointStats(appId, { nodeType, sinceMinutes }) | endpointStats(appId, nodeType, sinceMinutes) |
instances(appId), versions(appId), status(appId) | the same, each with an …Async twin |
each version's manifestJson, and manifest parsed | each version's manifestJson |
activateVersion(appId, version) | activateVersion(appId, version) |
setEnabled(appId, enabled, nodeType?) | setEnabled(appId, enabled, nodeType) |
connectAsDeveloper(appId, { nodeType, key }) | connectAsDeveloper(appId, ExecConnectOptions) |
orgComputeCeiling(orgId) (18.41.0) | orgComputeCeiling(orgId) (0.95.0), with an …Async twin |
callAsPolicy(appId), setCallAsPolicy({ appId, requiresPass }) (18.43.0) | callAsPolicy(appId), setCallAsPolicy(appId, requiresPass) (0.97.0), each with an …Async twin |
CrowdyPy 0.41.0 has client.exec.org_compute_ceiling(org_id), which returns an
OrgComputeCeiling: max_instances, max_reserved_mb, operator_set, funded,
default_max_instances, default_max_reserved_mb, reason, and updated_at.
The rest of the player's pass is on the server's
hub connection and on client.portal. No SDK vouches by itself: your server's code calls
vouch.
| What | CrowdyJS 18.43.0 | CrowdyCPP 0.97.0 |
|---|---|---|
| The pass in a token answer | AppTokenResponse.playerPass | Not selected in 0.97.0: ask for the pass after a mint and after each refresh |
| Ask for a pass with the player's app token | portal.playerPass() | portal().playerPass(), with playerPassAsync |
| Show a pass on the server's connection | hubs.vouch(player, pass), which resolves { ok: true } or { ok: false, error } | hub->vouch(player, pass, done) |
| A call-as refused because the app requires a pass | err.passRequired on the CrowdyExecError | ExecReply::passRequired() |
| A vouch whose pass was not taken | error.passInvalid | ExecReply::passInvalid() |
CrowdyPy does not have these calls.
Use CrowdyJS 18.1.0 or CrowdyCPP 0.55.0 or later on dev.
Coming from the legacy APIs
| Legacy | ck-exec |
|---|---|
computeModuleLogs, playerComputeLogs | execLogs |
computeModuleRuns, computeModuleStats, computeAppDiagnostics, gameModelAppDiagnostics, automation runs and stats | execInstances for what runs where, execEndpointStats for calls and latency per endpoint, and execLogs for what it said |
gameModelFlow, a function's flowId | execLogs(flow:): every line one call chain logged, on any hub and host |
| The invoke rate limit (120 per 10 s per player and app) | The same numbers per execution host, refused Busy ("rate limited") |
computeModuleVersions, computeDeployVersion | execVersions, and execDeploy then execActivateVersion to go back |
computeSetModuleEnabled, playerComputeSetEnabled | execSetEnabled |
computeResetBreaker | Nothing to reset: a crash-looping instance is held back (heldBack) until its crashes are a minute old, then placed again |
computeInvoke, gameModelInvoke (manual runs) | execConnectAsDeveloper, then call the endpoint |
appComputeBudget, setAppComputeBudget | The same budget; an enforced one pauses ck-exec code too |
Next: builds and starter packs.