What are Compute Units (CUs) and Throughput Compute Units (CUPs)?
At Alchemy, we provide a flexible and scalable approach to managing your blockchain applications by measuring usage in 2 key dimensions: Compute Units (CUs) and Throughput Compute Units (CUPs). CUs reflect the total computational resources your app uses, while CUPs measure your app’s throughput in terms of Compute Units per second. In this article, we’ll explain how these measurements work, how they impact your app’s performance, and how to efficiently manage usage to avoid overages.
Key Differences Between Compute Units (CUs) and Throughput Compute Units (CUPs)
To give you full control over your blockchain interactions, Alchemy uses 2 key dimensions to measure your usage:
Compute Units (CU): Compute units are a measure of the total computational resources your apps are using on Alchemy. You can think of this as how you would pay Amazon for compute usage on AWS. Some queries are lightweight and fast to run (e.g., eth_blockNumber) and others can be more intense (e.g., large eth_getLogs queries). Each method is assigned a quantity of compute units, derived from global average durations of each method.
Throughput Compute Units (CUPs): Each application has reserved dedicated Throughput, measured in Compute Units per Second. Applications can greatly exceed their dedicated throughputs based off of elastic demand in our system. Since each request is weighted differently, we base this on the total compute units used rather than the number of requests. For example, if you send one eth_blockNumber (10 CUs), two eth_getLogs (75 CUs), and two eth_call (26 CUs) requests in the same second, you will have a total of 212 CUPS. Note that even if your application limit is 200 CUPS, this throughput will likely be allowed still by the system.
Practical Example
Consider a free-tier Alchemy account, which includes the following limits:
Total Compute Units: 300 million CUs per month.
Throughput: 330 CUPs.
For instance, the getNFTMetadata method consumes 100 CUs and 10 Throughput CUs (CUPs). This means:
You can call getNFTMetadata up to 3 million times a month, given it's CUs cost of 100 CUs.
You can execute up to 33 calls per second, given its throughput cost of 10 CUPs
Managing Overages
Exceeding Compute Units: If you exceed the preset limits of your account tier (e.g., 300M CUs on the free tier), you can enable the Auto-scale feature starting on Growth tier. This feature automatically allocates additional CUs based on your app’s needs, ensuring uninterrupted service. Learn more about Auto-scale and how it applies to different account tiers here: Auto-Scale Compute.
Exceeding Throughput Compute Units: Exceeding your throughput limit typically results in a 429 error code. To efficiently handle these errors, implementing retries is recommended. The Alchemy SDK includes built-in retries, making it easier to manage request retries effectively. Further details on managing throughput can be found in our documentation: Throughput Documentation.
Viewing CU and CUPs Costs
To better plan and manage your application’s consumption of resources, you can view detailed CU and CUPs costs per endpoint on our documentation page. This will help you understand the specific costs associated with each API call you make. Visit the Compute Unit Costs page for complete details: Compute Unit Costs.