I'm quite new to EOS.

As far as I know, some of the output from smart contracts are also stored in the Log Storage.

At the same time, I can also choose to store those outputs in RAM.

My questions are, if the output info that I happen to need is also retrievable from the Log Storage.

When and why should I choose to those output information in RAM?

Can anyone tell me quantitatively what is the performance difference if my dApp is just going to retrieve from Log Storage vs. if it was retrieving from RAM?

To clarify, any action data in a transaction will go into log storage, the smart contract determines if it will also put it in RAM or not.

The decision to store information RAM is typically determined by what type of information is.

Information like..

  • Calculated numbers, e.g. Your EOS balance.
  • Number of votes for something
  • Likes/Dislikes count.

Would typically be stored in RAM, data like a social media comments would not be.

This is because a social media comment "Omg, this is so funny!" means nothing to a computer and does not need to be held so closely in RAM.

This type of decision between RAM storage or not naturally happens because RAM costs! Unlike CPU and Bandwidth which you get back, you don't get RAM back in the same sense, therefore dApp developers are forced to be minimal on the amount of data they put into RAM, what user will want to create a post if it's going to cost them $5 in RAM each time?

Data held in RAM is accessible really fast for any computer, let alone beefy Block Producer nodes. Because of this, your EOS token or any token balance is held in RAM. That way when someone sends you 5 tokens, it's already got your balance held in RAM ready to add 5 tokens onto your balance. EOS wouldn't be able to go as fast as it does, if it had to calculate's peoples balances by going through all their tx history to work out their balances and check for overspending.

Data placed into purely the log is inaccessible to the contract.

To utilise information placed purely into the log, Block Ones Demux can be used. Using this, you can serve content from your own centralised server to end users with data built from the decentralised EOSIO chain.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.