mina icon indicating copy to clipboard operation
mina copied to clipboard

Optimizing archive node genesis account function

Open dkijania opened this issue 1 year ago • 12 comments

Optimizing archive node genesis account function. Function tries to inserts all accounts specified in genesis ledger config file. However, it does it in non optimal way. Namely it open transaction at start then tries to add all accounts and finally commits. This can lead to OutOfMemory issues in postgres process as for instance mainnet genesis ledger contains 200k+ accounts. We experienced that problem on our performance environment. Solution is to make more granular commits during import. New code chop account to be inserted list into 100 account batches (this is measured value as 500 was also making postgres memory increase till 40~gb)

dkijania avatar Jan 15 '25 19:01 dkijania

!ci-docker-me

dkijania avatar Jan 15 '25 19:01 dkijania

!ci-docker-me

dkijania avatar Jan 16 '25 13:01 dkijania

!ci-build-me

dkijania avatar Jan 16 '25 20:01 dkijania

!ci-build-me

dkijania avatar Feb 11 '25 08:02 dkijania

!ci-nightly-me

dkijania avatar Feb 11 '25 09:02 dkijania

nightly: https://buildkite.com/o-1-labs-2/mina-end-to-end-nightlies/builds/3326

dkijania avatar Feb 11 '25 12:02 dkijania

!ci-build-me

dkijania avatar Feb 24 '25 09:02 dkijania

Is it possible for us to have a formula instead of using magic numbers?

glyh avatar Apr 29 '25 02:04 glyh

Regarding magic number, do you mean that chunks length is magic number :

let chunks_length = 100 in

? or something else too?

dkijania avatar Apr 29 '25 07:04 dkijania

Regarding magic number, do you mean that chunks length is magic number :

let chunks_length = 100 in

? or something else too?

Yes, the chunks_length. I assume you could in theory calculate the bound based on available memory & size of each record?

But if this is too complicated a formula in the end, I'm fine leaving this as is. As I understand that sometimes it's hard to actually do the formula.

glyh avatar Apr 29 '25 07:04 glyh

I think i can extract it to parameter with default value. what you think? Calculating its value based on resource is nice, but i think it should be done by some resources monitor tool outside archive process which will feed this value. Exposing it should be enough from archive perspective

dkijania avatar May 21 '25 07:05 dkijania

Make sense, please do :)

glyh avatar May 21 '25 07:05 glyh

!ci-build-me

dkijania avatar Jul 02 '25 15:07 dkijania

!ci-build-me

dkijania avatar Jul 08 '25 20:07 dkijania

!ci-build-me

dkijania avatar Jul 30 '25 18:07 dkijania

!ci-build-me

dkijania avatar Jul 30 '25 19:07 dkijania