-
xmr-prj-berman opened pull request #11827: FCMP++: include tree root and n tree layers in block header
-
xmr-pr
-
selsta.merge+ 11807 11808 11822
-
xmr-prAdded
-
xmr-prj-berman opened pull request #11828: FCMP++: return false instead of throw on invalid points for tree
-
xmr-pr
-
waltmckHey, I'm running a full monero node on a ZFS HDD array and I'm noticing very bad performance when syncing the blockchain from my client (feather wallet). It seems like the reads should mostly be sequential (we are reading the chain from start to end) but the performance is very close to the terrible random read speed of my array. Have you considered making the data.mdb layout have locality over the chain? Why did you decide not to do that?
-
br-m<ofrnxmr:xmr.mx> something-something lmdb
-
br-m<ofrnxmr:xmr.mx> Will let someone else chime in, but iirc lmdb is random and prefers ram
-
waltmckright yeah, even though the blockchain is basically append-only LMDB will use copy-on-write with a btree structure and destroy the nice locality the chain enjoys
-
waltmcklike I'm just kind of confused why do this instead of just serializing things sequentially. Maybe you were worried about the file getting corrupted so you wanted atomic database-like operations?
-
br-m<jpk68:matrix.org> The blockchain code is quite ancient and terrible
-
br-m<jpk68:matrix.org> Cuprate has done a lovely job of MVCC storage and all that. Good to have as a reference for upgrading our logic, I suppose
-
waltmckwould you take a PR to change the serialization to something more efficient?
-
waltmckI'm thinking that we just serialize the blockchain sequentially, without a database structure. We would need to be able to keep the same atomic-write guarantees as lmdb, so that might be the tricky part. However, this should not be as hard as the general database case (and we should definitely not need to CoW) given the property of a blockchain "we never overwrite a block without also overwriting all blocks written after that block." Thus, we can just st
-
waltmckore an atomically-updated counter of "current length o the blockchain" at the start of the file, and whenever we want to add stuff we just first write the stuff then increase the counter atomically. To overwrite stuff, we first atomically decrease the counter, then overwrite the stuff, then increase it again.
-
waltmckwe could support simultaneous readers and writers with a RW lock. Readers would first take a read lock, then read the counter, then read stuff they need (up to the counter), then release their lock. The writer would only need to take the write lock when decreasing the counter (not when increasing it or actually writing anything) so there would be minimal contention
-
waltmckok actually it looks like cuprate uses almost exactly the architecture I just proposed
-
hycyeah that's nonsense. the blockchain is not mainly sequential.
-
hycIt has multiple indexes that are required to support lookups of transactions and outputs. all of those items are identified by hashes.
-
hychashes are non-sequential, they are random order.
-
hycevery time a block is added multiple index entries must be written, for every txn in the block.
-
hycstoring a functional blockchain is more than just sequentially appending blocks to a file.
-
hycyou also have to handle multiple chains, when there are forks that haven't resolved. and rollback or discard when they finally do. No real-world blockchain only handles sequential adds.
-
br-m<boog900> For monero almost all the blockchains read workload is over tables that can be updated by just appends. Getting ring members is done by their index. The only one that needs a search is key images but even then that is a negative look up (we check a given key image is not in the table) which can be made faster with a filter. > <hyc> yeah that's nonsense. the blockchain is not mainly sequential.
-
br-m<boog900> Cuprate makes the indexed tables (almost all the tables used for consensus) fast and compact with a custom database and for the others we use a Rust LSM tree database which is faster at writes but slower at reads. However, as I said, it does not matter for moneros work load that these tables are slower at reads.
-
br-m<boog900> Cuprate's DB is smaller and faster than monerod's for moneros workload. Massively so for HDDs.
-
br-m<monero.arbo:matrix.org> cuprate fixes this to an extent btw. part of the database is virtual tape (append only) > <waltmck> right yeah, even though the blockchain is basically append-only LMDB will use copy-on-write with a btree structure and destroy the nice locality the chain enjoys
-
br-m<monero.arbo:matrix.org> jk u found it urself
-
xmr-prfkobi opened pull request #11830: cmake: remove needless comparison
-
xmr-pr
-
hycif you're writing the main chain and multiple indices you still lose the sequential access pattern
-
br-m<boog900> Cuprate's database works by keeping each table in a separate file, a write is just appends to each file.
-
hycif your goal is eliminating random seeks, that's still nonsense. writing to separate files still requires a random seek to each file.
-
hycusing multiple files also means you're far more vulnerable to crash corruptions, since you have to fsync each file separately to ensure their data goes to disk.
-
hycinstead of a single fsync to a single LMDB file
-
br-m<jpk68:matrix.org> Have you tried out Cuprate for yourself? The speed compared to monerod is quite insane, so they must be doing something right :D
-
br-m<boog900> I mean yes it is impossible to make the work 0 but we do significantly reduce it compare to what monerod does
-
hychave they tested crash recovery?
-
br-m<boog900> yes, each update is atomic across the files
-
selstatobtoht: 11807 11808 11822 are good to merge once you have time, then we can tag. I did not find any regressions.
-
tobtohton it
-
tobtoht.merges
-
xmr-pr7940 10296 11288 11506 11509 11544 11566 11567 11570 11571 11578 11579 11580 11617 11622 11632 11634 11680 11695 11702 11703 11708 11709 11767 11807 11808 11822
14 minutes ago