Why Does My Account Run Out of CPU on EOS?
One of the differentiators that sets EOS apart from other blockchains is its resource staking mechanism -- users get access to chain-wide CPU and bandwidth resources by staking EOS tokens. However, with the incredible user and dapp adoption that we’ve seen, resource staking has also become a bottleneck at times. Block Producers and Block.one have both been working to resolve these issues.
In this post, EOS Canada will first explain CPU and how it is utilized, and then describe the current issues regarding CPU, what solutions have been tried, and new solutions that are being worked on for future improvements.
What Is CPU Used for on EOS?
Whenever you submit a transaction to the EOS network, Block Producers must then process that transaction. CPU is the length of time, measured in microseconds (μs), that a Block Producer has to expend on processing to validate the transaction. Since each Block Producer runs a different infrastructure setup, CPU is subjectively billed by each Producer. This has led to the development of some tools to measure, as best as possible, the relative speed of execution of each Block Producer. These tools are available through benchmarking sites.
The community has seen some incredible reductions in execution times thanks to infrastructure upgrades, compiler improvements, WebAsssembly (WASM) virtual machine performance optimizations, moving signature verification to a separate thread, and dapp-side code optimizations.
How Much CPU time Do I Get Per EOS?
Within EOS, blocks are created 500 milliseconds apart. To help ensure that Block Producers have enough time to propagate blocks around the world, there is a per-block processing time limit of 200 milliseconds within which a Producer has to validate the block before broadcasting it to the network. This leaves 300 milliseconds for propagation across the network.
Another constraint is that within the cap of 200 milliseconds, there is also a percentage threshold at which rate limiting begins. Before this limit is reached, all users can freely transact on the network as it is not in “congestion mode.” Once this limit is passed, users are throttled back to their pro-rata share of the total CPU-per-staked-EOS allotment. To view a real-time chart of the CPU-per-EOS allotment, you can utilize this tool by EOS Titan.
To put this into simple numbers to help illustrate the point, if there were 1000 tokens being staked for CPU at a given moment, and my account had 20 tokens staked, then I would be guaranteed 2% of the total CPU capacity of the network. If the network was not being heavily used and hadn’t reached the threshold at which rate limiting is activated, I would be able to push transactions through above my guaranteed amount. Once that threshold is passed, I would not be able to exceed my allotment.
Why Does My Total CPU time Fluctuate?
When you check the amount of CPU time your account has available on a block explorer, you will find two separate values: ‘used CPU’ and ‘total CPU’. You’ll also notice that if you refresh the page during a period when the chain is in congestion mode, your ‘total allowed CPU’ time can vary wildly.
To demonstrate this, look at these screenshots of the same account’s CPU monitor as seen on eosq, with one showing almost double the available resource versus the other, although they were taken less than a minute apart.
Further, since your ‘total CPU allowed’ can change depending on network usage, you may find that your account shows as having used more than 100% of its allotment during times of congestion.
Do I Have To Keep Buying CPU?
As CPU is a transient resource, your account will recoup any ‘spent’ CPU over a period of 24 hours. A user can also always unstake their tokens staked towards CPU, recouping their EOS tokens. So while the word “spent” is used when talking about resources, you are not actually losing any of your tokens.
A user can also have CPU delegated to their account by another user. This has led to some services that offer free CPU in small amounts, and some that offer larger quantities for a fee. To learn more, you can look into CPUEmergency, Bank of Staked, and Chintai for just a few of the options available.
How Much CPU Do I Need?
If you’re unsure how much CPU you need to interact with the EOS blockchain, you’re not alone. Because parameters and infrastructure are constantly changing, and no two dapps are created equal, there aren’t any definitive guidelines. EOS New York has put out a handy site, EOS Charge, that will give you an estimate of how many times your account will be able to perform common actions. The amount shown will always be changing, so it should be seen only as an approximate guideline.
The amount of used CPU displayed within a block explorer will only update once you have pushed a transaction to the chain. So don’t be worried if after 24 hours it still shows as your account being maxed out for CPU -- go ahead and make a transaction and your used CPU will update.
Hopefully this has helped to demystify CPU and how it is involved in your day-to-day interactions with the EOS blockchain. If you have any further questions, or just want to say hi, please stop by our Telegram channel.
I got into EOS last Friday and its just been brutal trying to use the network cuz of the low CPU I have. I can't even stake more if I wanted to. 1 transaction a day max is about what I get(IF I catch it in a good time).
Thank you so much for sharing this amazing post with us!
Have you heard about Partiko? It’s a really convenient mobile app for Steem! With Partiko, you can easily see what’s going on in the Steem community, make posts and comments (no beneficiary cut forever!), and always stayed connected with your followers via push notification!
Partiko also rewards you with Partiko Points (3000 Partiko Point bonus when you first use it!), and Partiko Points can be converted into Steem tokens. You can earn Partiko Points easily by making posts and comments using Partiko.
We also noticed that your Steem Power is low. We will be very happy to delegate 15 Steem Power to you once you have made a post using Partiko! With more Steem Power, you can make more posts and comments, and earn more rewards!
If that all sounds interesting, you can:
Thank you so much for reading this message!