-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: store seed command in stress test CLI #657
base: next
Are you sure you want to change the base?
Conversation
Do you know where the bottlenecks are? Taking a brief look at the code it seems like we are instantiating a lot of random number generators - these could be quite expensive (especially the RPO ones). So, I'd switch to lighter versions and also try to use the same instance as much as possible.
Something doesn't seem right here:
|
I didn't check how size is measured; but the write could be stuck in the WAL file still? |
I was checking only the size of Though I want to clarify that it is each 1000 batches, each block is 16 batches in the implementation so we keep track of the increase of size every 62.5 blocks.
The 7k are batches, so it is like ~440 blocks. We are using 255 accounts per block + 1 tx to mint assets to each one of the accounts.
I will come back with the results of this new run with 1M accounts and with the store size fixed. Currently it is taking like ~1 hour to run for 1M accounts (for the total process). |
here you can visualize a flamegraph for 1M accounts (removed the preview because it was too big): |
I added a couple more of metrics, and re run a couple times with different number of accounts. I'm consistently getting 4550~ish bytes/account |
It is worth mention that this number is the result of doing I ran the following query in the DB and got this results: SELECT
name,
SUM(pgsize) AS size_bytes,
(SUM(pgsize) * 1.0) / (SELECT COUNT(*) FROM accounts) AS bytes_per_row
FROM dbstat
WHERE name = 'accounts'; And got this results: |
4.5KB is better than 5MB - but still looks pretty high. Part of this is nullifiers and notes - but I don't see how these contribute more than 1KB (about 40 bytes for nullifiers + 80 bytes for notes + 500 bytes for note authentication paths). But it is also possible I'm missing something. Another possibility is that SQLite doesn't do compaction, and maybe there is a lot of "slack" in the file. |
There's also the overhead of block headers and indices as well, but those are also probably too small to consider. |
I added some queries to check the size of each table, and the avg size of each entry in every table. This is the current output of the binary:
|
58cac73
to
348b54c
Compare
I could not reduce the time that takes for each block. It is currently at 1.6 blocks/sec |
Do you have the breakdown of different components of this? Specifically, how much, out of 1.6 seconds is taken up by block construction vs. block insertion? |
Interesting! It seems like 97% of the database is in the |
@bobbinth I created #662 to address the notes issue.
According to the flamegraph, a big part of this process is in |
Looking at the code, I think what we are measuring as insertion time is actually What may make sense to do is build blocks manually (and probably the same for batches as well), without using block and batch builders. This is somewhat difficult now, but should become much easier after #659 and subsequent work is done. So, I guess we have 3 paths forward:
Assuming this is pretty close to being done, path 1 probably makes the most sense - but let me know what you think. |
@@ -15,35 +15,37 @@ version.workspace = true | |||
workspace = true | |||
|
|||
[features] | |||
testing = ["dep:miden-air", "dep:miden-node-test-macro", "dep:rand_chacha", "dep:winterfell"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With a more manual approach to batch/block building, we probably wouldn't need to introduce the testing
feature. So, maybe that's an argument for putting the work on hold for now.
@bobbinth i'm applying your suggestion of a new structure (your comment here). The only thing I changed is that I create all the accounts before hand.
I added some queries to check the size of each table, and the avg size of each entry in every table. This is the current output of the binary:
For example, this is the current output for 100k accounts:
This PR was built on top of #621 .