0

Today, I found out how EOS creates and saves new accounts. But I am still not sure whether EOS saves new accounts on RAM or on disk?

1

The new account is stored on RAM, nothing is stored on disk with EOS.

  • Well, so when I created 1.000.000 accounts on my computer(1GB RAM , 512 GB SSD) but EOS still run? Why? (with 4KB for an account) – user2644 Nov 27 '18 at 6:50
  • If you are on testnet or mainnet then your RAM will not be occupied i am amazed that you managed to run eos on 1gb RAM. – Mr.Y Nov 27 '18 at 6:55
  • @Mr.Y, I am on testnet, I am not clear with your answer, because I just want to test my knowledge when I read code of EOS. Why my RAM not occupied? I think when i create new account, it will be store on account_object table (in function apply_eosio_newaccount) and it consumes RAM. But when I test it that its not true. – user2644 Nov 27 '18 at 7:14
0

New accounts will consume RAM. The data of your new accounts will be saved in the state which is in the RAM. However, if your machine running nodeos does not have enough memory for the whole state, swapping will happen, which means your nodeos instance will have to access your virtual memory on hard drive and read/write disk frequently. This will drastically slow down your nodeos performance.

In addition, the transactions/actions that create your new accounts will be saved in block data. You could think of this as saved on disk (mostly).

  • Thank you for your comment, so How can I calculate how many RAM can be swapped? Where I can read it? Please give me some advice, thanks. – user2644 Nov 27 '18 at 7:17
  • @Onotoko Swap is a linux/unix system concept, linux.com/news/all-about-linux-swap-space – Tong Shen Nov 27 '18 at 16:26
0

Here is some description of RAM. i.e, RAM is used for permanent storage. One example is how account keys and balances needs to be stored in RAM and accessed very quickly every time they are called upon. So while it may not be the traditional definition of “permanent”, on the EOS blockchain RAM provides a permanent means of storage.

When you created account on testnet it means it occupied some RAM which is bp's RAM not your local machine's RAM.To check your ram usage you can either go on testnet site and go on account info tab or you can check by the command cleos get account "ACCOUNT_Name" it will show you your account information.

  • Thank @Mr.Y, I got it, but my answer is why 1 million accounts can run on computer which has only 1GB RAM :) – user2644 Nov 27 '18 at 7:37
  • As i said it is not based on your machine's RAM.It is based on your accoun's RAM which is a part of Block Producer's RAM. – Mr.Y Nov 27 '18 at 7:50
  • Well, maybe I am wrong when understand this machine is a Block Producer that mean when I run EOS on local, it is a Block Producer. Am I wrong? If I wrong so if I set 'chain-state-db-size-mb' equal 512, EOS will be broken? – user2644 Nov 27 '18 at 7:56
  • If you run eos on local and make account on that(means by accessing on127.0.0.1:8888 or your nodeos port) it will consume your RAM but as you said you are on testnet means you are accessing block producer's machine resources. – Mr.Y Nov 27 '18 at 8:30
  • Thank @Mr.Y, I think I need to change value of 'chain-state-db-size-mb' and test again. I hope after that I can understand more about this problem. – user2644 Nov 27 '18 at 8:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy