Internet Computer

What limits apply to canister calls and messages?

All help topics

Every call to a canister is a message, and messages are limited in size and in how much work one execution may do; calls between canisters also stop being atomic at each await.

Size
  • Request and response payloads are limited to 2 MB each, for calls from users and between canisters. A larger request fails; a larger response traps. Split big data into chunks of about 1 MB, for example with paged queries or chunked uploads.
  • Wasm modules over about 2 MB are uploaded in chunks; icp deploy does that for you.
  • An environment variable's value can be at most 128 characters.
Work
  • Each message execution has an instruction limit. A loop over a large collection in one call can hit it and trap. Do long work in batches, over several messages (timers help).
  • Upgrade hooks have their own instruction limit, which is why large data belongs in stable memory rather than being serialized during an upgrade.
Memory
  • Heap memory goes up to 4 GB (32-bit Wasm) or 6 GB (64-bit); stable memory to hundreds of GB within the subnet's storage. On a cloud engine, the node class sets that storage.
Calls between canisters
  • Not atomic across await. The code before an await and the code after it are separate executions. If the method traps after the await, the changes made before it stay. Guard against reentrancy, for example with a lock, and design for partial failure.
  • Unbounded-wait calls always get a response, but a callee that never answers keeps the caller from being stopped or upgraded.
  • Bounded-wait calls have a timeout (at most 300 seconds) and may come back as SYS_UNKNOWN: the call may or may not have run. Make such calls idempotent, or give the callee a way to look up the outcome.
  • Across subnets, calls take a few rounds and share limited bandwidth; calls between canisters on the same subnet are faster.
  • A callee can reject or trap: handle errors instead of letting them trap your canister.

On a cloud engine, every call that crosses the engine's boundary must also be bounded-wait and carry no cycles: see "Why does a call from my engine canister fail when it works on other subnets?".

Learn more
Still stuck? Contact support