Skip to main content

Resource limits

Beginner
Concept

Overview

The Internet Computer uses WebAssembly as the platform for executing messages of smart contracts. Since WebAssembly is Turing-complete, it can express different kinds of computations including non-terminating computations. The Internet Computer protects against non-terminating computations by limiting the number of WebAssembly instructions and other resources per message execution. The limits depend on the message type as shown in the following table.

Resource constraints and limits

Message resource limitsConstraint
Message queue limit, messages per canister500
Maximum ingress message payload2MB
Maximum cross-net inter-canister message payload2MB
Maximum same-subnet inter-canister message payload (may be deprecated at some point)10MB
Maximum response size (replicated execution)2MB
Maximum response size (non-replicated execution, i.e. in query calls)3MB
Instruction resource limitsConstraint
Instruction limit, instructions per update call/heartbeat/timer20 Billion
Instruction limit, instructions per query calls5 Billion
Instruction limit, instructions per canister install/upgrade200 Billion
Instruction limit, instructions per inspect_message200 Million
Subnet
limits
Constraint
Subnet capacity (total memory available per subnet)700GiB
Memory resource limitsConstraint
Wasm heap memory, per canister4GiB
Wasm stable memory, per canister400GiB
Wasm custom sections, per subnet2GiB
Wasm custom sections, per canister1MiB
Wasm custom sections, sections per canister16
Wasm code section, per canister10MiB
Query call resource limitsConstraint
Query calls execution threads, per replica node4
Query calls execution threads, per canister2
Update call resource limitsConstraint
Update calls execution threads, per subnet4
Update calls execution threads, per canister1

Additional notes

The Internet Computer Protocol may reject WebAssembly modules for reasons such that:

  • They declare more than 50_000 functions.
  • They declare more than 1_000 globals.
  • They declare more than 16 exported custom sections (the custom section names with prefix icp:).
  • The number of all exported functions called canister_update <name> or canister_query <name> exceeds 1_000.
  • The sum of <name> lengths in all exported functions called canister_update <name> or canister_query <name> exceeds 20_000.
  • The total size of the exported custom sections exceeds 1MiB.

More information regarding these restrictions can be found in the Internet Computer interface specification.