警告:您可能成为了企图假冒本网站内容的目标。 我们检测到该网站被IFRAME包裹,这意味着与EOS Canada无关的人试图向您展示他们的内容与我们的内容相关,可能为了让您相信他们与EOS Canada有关。 我们与任何试图这样做的组织都没有联系,它也没有受到我们的认可



WARNING: you may have been the target of an attempt to misrepresent the content of this site. We detected that the site was wrapped in an IFRAME, which means that someone else, not associated with EOS Canada, attempted to show you their content combined in some way with ours, possibly to make you believe they are associated with EOS Canada. We are not associated with, and do not endorse, any organization attempting to do this.
background-flotant-top-right-01

Blog: EOS Block Producer Tips & News

background-flotant-top-left-01

Why Does My Account Run Out of CPU on EOS?

December 07, 2018 / by Josh Kauffman

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.

CPU Variance

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.

Topics: resources, cpu, staking, EOS, Education

Josh Kauffman

Written by Josh Kauffman

Josh wants to educate those around him. Since learning of cryptocurrency, he’s become a missionary -- urging those around him to understand this technology that will underpin tomorrow’s world. His latest passion is the crypto space, looking to be part of those who lead the drive towards Web 3.0.

cubes-solid

ABCs of EOS

A glossary of terms that every EOS user should know.

MORE

Apply to Access Our Newsletter

Get exclusive insights into EOS blockchain technology