-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Here are number of DB queries made in semi-realistic setting (4 nodes, H=633)
79723 "SELECT MAX(height) FROM thm_blockchain"
9099 "INSERT OR IGNORE INTO thm_wal VALUES (NULL,?,?)"
5130 "SELECT valset FROM thm_validators WHERE height = ?"
2193 "SELECT block FROM thm_blockchain WHERE height = ?"
1660 "SELECT bid FROM thm_blockchain WHERE height = ?"
1039 "SELECT round FROM thm_blockchain WHERE height = ?"
633 "SELECT message FROM thm_wal WHERE height = ? ORDER BY id"
633 "DELETE FROM thm_wal WHERE height < ?"
632 "INSERT INTO thm_validators VALUES (?,?)"
632 "INSERT INTO thm_commits VALUES (?,?)"
632 "INSERT INTO thm_blockchain VALUES (?,?,?,?)"
310 "SELECT cmt FROM thm_commits WHERE height = ?"
What could we see
- Querying blockchain height is largest number of queries by far. But it's very cheap query and relevant data is likely to sit in disk cache anyway
- Second is writing of WAL and if . We write about 14 messages per height. Absolute minimum is
StepNewHeight+ 1 propose + 4 prevotes + 4 precommits. There's not much we can do except
- Filter duplicate messages before they hit WAL
- Do not send expired timeouts Do not send expired timeouts #441
- Third is block requests. Luckily caching of block could be implemented in relatively straightforward manner thanks to BCH immutability