-
Notifications
You must be signed in to change notification settings - Fork 116
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
tapdb: allow batch inserting proofs when syncing universe, remove write lock for RegisterIssuance #449
Conversation
91848b3
to
a7d03b6
Compare
a7d03b6
to
e9d156c
Compare
I was able to complete a full asset mint with 10k assets with Postgres on my local machine today 💯 Here are some statistics of the run:
EDIT: After a few optimizations, I was able to get a full run in 4541s. Attaching the log if anyone is curious: |
e308cdc
to
711414b
Compare
Still want to add some additional unit tests to the database around batched insertion, but the PR should otherwise be ready for re-review. |
eab0b65
to
66effd0
Compare
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.
Didn't yet bench locally but this was a great read! Cool to see fn
used to great effect.
Confirmed no regression with SQLite at batch size 1k. Left most of my comments on existing threads.
Needs a rebase! |
66effd0
to
234008e
Compare
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.
LGTM! 🚀
We avoid several encode/decode cycles by keeping the raw proof in the minting leaf instead of the encoded one.
When syncing proofs from a remote universe, we download the proofs in parallel. But to avoid also hammering the DB with parallel write requests, we batch the writes.
234008e
to
df11d35
Compare
We also want to insert proofs in batches into the local universe when we mint multiple assets.
Instead of having three make goals for the optional itests, we use an argument (make itest optional=true), which also makes it easier for us to increase test and postgres harness timeouts during those optional tests.
It seems like Ubuntu 22.04 (current latest) terminates build jobs because of high CPU usage sometimes (see actions/runner-images#6680). We attempt to fix this by using the older runner.
df11d35
to
beb76bc
Compare
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.
LGTM 🐙
|
||
// We use an error group to simply the error handling of a goroutine. | ||
batchSyncEG.Go(func() error { | ||
newLeafProofs, err = s.batchStreamNewItems( |
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.
Very cool pattern! I think we might need just one more light layer of abstraction to make it a bit more readable, but I dig the structured concurrency here.
Fixes #374.
Opening as draft, want to address the following TODOs before full review:
Code cleanupAllow federation envoy to also support batch inserting, will speed up local insertion