Costs on the Internet Computer

First, a HUGE thank you to @SuddenlyHazel on Twitter for the cost analysis. Give her a follow as she is doing lots of amazing things on the Internet Computer all the time. You can check out her IC cost thread here.

Costs on the Internet Computer are complicated because you fund canisters with cycles that were converted from ICP. So ICP -> cycles -> computation, storage, and communication.

ICP, Cycles, and SDR

The ICP to cycles conversion rate is determined through an NNS proposal that happens frequently (something like every 5 minutes). The proposal sets the ICP to SDR/XDR currency conversion rate. SDR/XDR is a stable currency as it is a basket of currencies including the US dollar, Japanese yen, Chinese yuan, euro, and the pound. So take the current price of ICP, for this example let’s assume $50. Then divide by the current SDR price, which is around $1.40, to get the ICP to SDR conversion rate. In this case, $50 / $1.40 = 35.714.

The reason ICP to SDR is important is because 1 Trillion cycles is equal to 1 SDR. So 1 Trillion cycles costs around $1.40 and moves up and down as the price of SDR moves up and down.

Now that we have this foundation, what is a cycle? And how do we know how much things cost?

From the Dfinity documentation,

Cycles represent the cost of executing each application’s WebAssembly instructions

https://sdk.dfinity.org/docs/developers-guide/concepts/tokens-cycles.html

This just means that cycles pay for communication, computation, and storage. On that note, let’s dive into the costs!

There are two types of calls to the Internet Computer: query calls and update calls.

Query Calls / Data Transfer Out / Reading Data

Query calls (or simply reading data) are cheaper and faster because you do not have to go through consensus in order to return data. This means you don’t need to talk to ALL of the nodes in a subnet in order to pull data. Your request will get a response from the nearest node and you get your data back. Query calls are cheap and fast.

In Hazel’s analysis, she lists that it costs about $82 USD for 150 Million query calls returning a 2MB payload. That is 300 Terabytes of data! To compare data transfer costs, let’s convert this to $$ per GB. $82 / 300,000 = $0.0002733 / GB.

To put this in context, AWS charges $0.07 / GB for data transfer out, regardless of whether you are pulling from RDS (normal relational database on AWS) or S3 (normal file storage on AWS and stands for Simple Storage Service). This means it would cost $21k to read 300 TB of data from AWS.

This means that AWS data transfer out costs 256 times more than Internet Computer data transfer out (!!!). This might seem crazy but Hazel mentions AWS is notorious for charging $$ for bandwidth, and as you’ll see later, subsidizes data transfer in costs so they have to make their money somewhere.

Update calls / Data Transfer In / Saving Data

Update calls cost more than query calls because you have to reach consensus on state changes, or rather when you save data, you have many places you need to save it. As the replication factor goes up, the cost of update calls will also go up because you’ll need to replicate your state (or data) across all of the nodes in your subnet.

According to Hazel’s cost analysis on Twitter, it takes 6.6 Trillion cycles to put 1 GB of data on the IC, which is about $9.56. So saving 1 TB of data to the IC would cost $9,560.

To put this in context, AWS doesn’t charge anything for data transfer in. This cost must be subsidized to incentivize people to put their data in AWS. So it would cost $0 on AWS to put 300 Terabytes in, and this same process would cost $2.8M to put on the Internet Computer. Also to provide more information, I’m guessing the replication factor for nodes in the subnet was 7 (for Hazel’s testing), so you are essentially copying 300 TB of data to 7 different places around the world, automatically increasing the security and persistence of your data. But yes, each copy would cost around $400k to get there. In this example, AWS is infinitely cheaper because AWS subsidizes the cost of incoming data to $0.

Data Transfer

Data transfer is defined as going from one canister to another canister. The AWS equivalent would be transferring from one region to another region. There is not a specified way to transfer data, this is simply canister A calling canister B and passing data.

Hazel’s analysis shows the starting canister has to pay about 1 Trillion cycles / GB (~$1.40/GB) and the receiving canister has to pay about 0.036 Trillion cycles / GB (~$0.05/GB). So to transfer that 300 TB data we have been using as an example, it would cost $420k for the starting canister, and $15k for the receiving canister.

To put this in context, AWS charges $0.02 / GB for data transfer between regions. This means the 300 TB file transfer would cost $6,000, which is 72 times cheaper than on the IC.

Storage

It costs 4 SDR to store 1 GB of data on the IC for a year. That is about $5 / GB / year for storage. This means our 300 TB example would cost $1.5M to store on the IC / year.

To put this in context, AWS S3 charges $0.023 / GB / month, or $0.276 / GB / year. This means the 300 TB example would cost $82,800 to store on S3. For AWS RDS, the cost is $0.115 / GB / month, or $1.38 / GB / year, which means the 300 TB example would cost $414,000. This means storage on the IC is 3.62 times more expensive than storage on AWS, although on the IC you get default replication whereas you only get one instance of your data on AWS. So technically you could argue that storage is actually cheaper on the Internet Computer because the per replication cost on the IC is 52% of what storage on AWS would be assuming an identical replication configuration (and assuming identical costs for additional replications on AWS).

Input Output Operations

The final experiment Hazel did looked at how many messages/second a canister can handle. She hit the same canister from 7 different canisters, each sending 30 calls at the same time with 100 byte payloads. The average processing rate was 21 messages / second, with a high of 70 and a low of 16. It will be interesting to see how much synchronous load a canister/node/subnet can handle before it starts to experience increased latency.

Worked Example

We’ve thrown around a lot of numbers, so let’s do a real-life worked example to compare costs more systematically.

Let’s assume we put 1 TB of data in and then we read it 1,000 times. I’m not sure on the balance between reading and writing data, but this feels entirely possible in a modern web app.

Data TransferInternet ComputerAWS
Data IN cost$9.56 / GBFree
Data OUT costs$0.0002733 / GB$0.07 / GB
IN cost for 1 TB$9,560Free
OUT cost for 1 TB$273.30$70,000
Total cost for 1 TB$9,833.30$70,000
Internet Computer and AWS costs to save 1 TB of data and then read it 1,000 times.

Note that while the Internet Computer data IN cost is higher than the subsidized “Free” data IN cost of AWS, the data OUT costs are so much lower that it looks like it actually might be cheaper to run an app on the Internet Computer than on AWS. And you even get 7x replication on the Internet Computer by default, where you do not get any replication at all by default on AWS.

Conclusion

There is still a LOT we don’t know about costs on the IC. This was one (very smart) developer running one set of (well conducted) tests to get a better idea of costs on the IC. We need more developers looking at cycle costs under different scenarios before we can get a more comprehensive summary of IC costs.

Note: These tests may not have resulted in true costs on the Internet Computer. More tests are needed to understand costs under different circumstances on the IC.

Relevant Community Comments

Ayjayem from DSCVR: So here’s the interesting thing about costs of data-in/data-out, based on a quick read of the numbers that Hazel and Bob very helpfully compiled: while it’s free to load data on AWS, it costs way more to read it on AWS. And in the simplest case, you only need to load up data once, and then it gets read many more times. A simple break-even analysis shows that the IC is actually *cheaper* than AWS if, for every GB saved, that saved GB is read ~137 times: $9.56/($0.07 – $0.0002733). This is quite a plausible scenario, I would think. (Not to mention that you get 7x replication on the IC by default!) That said, in the not-too-distant future, it would probably make sense to match the balance of data-in/data-out costs more closely with AWS, so as not to put off would-be IC devs (who will always need to save data first, before it can be read).

Ayjayem from DSCVR on the fact that AWS is much cheaper than the IC: I actually don’t read the costs this way at all: storage is in fact cheaper on the IC, per replication factor; and data-in/data-out costs are quite comparable when read together, even without replication (see response to Jpexome elsewhere in this thread). Data transfer costs look higher (~10x greater when accounting for differences in replication factor), so services relying on other own (or 3rd-party) code will likely be more expensive on the IC. But then again, API-enabled IC services can do things (with e.g. immutable 3rd-party canisters) that can’t be done on web 2.0 AWS services! So if that’s what’s being offered, users should be willing to pay more!

css.php