EOSIO / eos

An open source smart contract platform
https://developers.eos.io/manuals/eos
MIT License
11.28k stars 3.6k forks source link

state/shared_memory.bin file Mapped memory cause too many buff/cache memory #7760

Closed ling2yt closed 5 years ago

ling2yt commented 5 years ago

i got the system memory waring message one day. After checking with top, /proc/meminfo and /proc/pid/smaps , I found RSS for state/shared_memory.bin file toke the most cache memory. I got 600+M used memory , and 12G buff/cache memory with "free" commond and /proc/meminfo file. Will the RSS memory cause the unsafe database usage exception ?

void controller::validate_db_available_size() const { const auto free = db().get_segment_manager()->get_free_memory(); const auto guard = my->conf.state_guard_size; EOS_ASSERT(free >= guard, database_guard_exception, "database free: ${f}, guard size: ${g}", ("f", free)("g",guard)); }

I have set the --chain-state-db-size-mb parameter to 12G already. many thanks

spoonincode commented 5 years ago

The most accurate way of seeing the state DB usage is to add the eosio::db_size_api_plugin plugin and then make a request such as

$ curl http://127.0.0.1:8888/v1/db_size/get
{"free_bytes":882280544,"used_bytes":"7707654032","size":"8589934576" .......

The absolute minimum size required will be different depending on the chain. For example, "mainnet" needs 8GB currently but jungle testnet needs 3GB currently. However it's important to note that if every "mainnet" RAM owner decided to use their RAM you would need over 64GB. So if you want your node to handle potential surges in RAM usage without hitting the guard and shutting down you will need to set chain-state-db-size-mb larger than something near the absolute minimum.

ling2yt commented 5 years ago

After I using the mongodb ,I can't get transactions with the "cleos get transaction xxxx" any more I have open the history_plugin and history_api_plugin and I can get the transaction from mongodb. Should I query the transactions from the mongodb?

heifner commented 5 years ago

Yes, nodeos does not query mongodb, it only pushes to it. Query your mongodb directly.

spoonincode commented 5 years ago

I think we can close this; nothing really actionable here