-
Notifications
You must be signed in to change notification settings - Fork 154
Change fog-ledger to support getting ledger data from a remote mobilecoind #3701
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eranrund
commented
Nov 9, 2023
eranrund
commented
Nov 9, 2023
eranrund
commented
Nov 9, 2023
eranrund
commented
Nov 9, 2023
eranrund
commented
Nov 9, 2023
cbeck88
reviewed
Nov 9, 2023
Annoyingly renaming a branch on GH closes the PR instead of moving it to a new branch. I'll bring it back once I'm done working on it. |
eranrund
commented
Nov 20, 2023
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.
a few nits and some questions on how missing/unfound blocks are handled.
nick-mobilecoin
approved these changes
Nov 22, 2023
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Right now every instance of fog-ledger-router and fog-ledger-store run their own
mobilecoind
and sync the ledger and watcher databases. This is inefficient in terms of storage, and increases our ongoing operations costs.The changes in this PR:
mobilecoind
endpoints to accommodate for the type of queriesfog-ledger
needs to domc-fog-block-provider
crate that provides an abstraction over the database queriesfog-ledger
is doing, and two implementations: one that uses the local lmdb databases and one that uses a remotemobilecoind
fog-ledger
server binaries to allow either using local databases or a remotemobilecoind
.Performance
To verify the performance of thi 8000 s I ran the fog-test-client locally (for my future self:
MC_CONTINUOUS=true MC_TRANSFER_PERIOD=15 MC_TELEMETRY=true RUST_LOG=trace SGX_MODE=HW IAS_MODE=DEV CONSENSUS_ENCLAVE_CSS=$PWD/keys/libconsensus-enclave.css VIEW_ENCLAVE_CSS=$PWD/keys/libview-enclave.css INGEST_ENCLAVE_CSS=$PWD/keys/libingest-enclave.css LEDGER_ENCLAVE_CSS=$PWD/keys/libledger-enclave.css cargo run --release -p mc-fog-test-client -- --chain-id mc-fog-mobilecoind --key-dir keys/fog_keys --consensus mc://node1.mc-fog-mobilecoind.development.mobilecoin.com --num-clients 4 --consensus-wait 300 --transfer-amount 20 --fog-view fog-view://fog.mc-fog-mobilecoind.development.mobilecoin.com --fog-ledger fog-ledger://fog.mc-fog-mobilecoind.development.mobilecoin.com --admin-listen-uri insecure-mca://0.0.0.0:8001/
) and queried the Prometheus metrics endpoint (grpcurl -d '' -plaintext -protoset ./admin.protoset 127.0.0.1:8001 admin.AdminAPI.GetPrometheusMetrics | jq -r .metrics
) after it did some iterations.The local mobilecoind ("stock" but with the support for remote mobilecoind - e.g. switching to
Box<dyn BlockProvider>
but using the local lmdbs implementation) did 52 iterations before I stopped it, and the remote one did 124 iterations - this has nothing to do with performance, this is just how long I let it ran. I was aiming for 50 iterations but got distracted and didn't Ctrl+C the remote version early enough, so we got more data points.Here's my analysis:
(The table might be a bit hard to read, https://docs.google.com/spreadsheets/d/1dwfzj3RQ99ubUNWRTFxpstucmHLAhdTgkyJ3GDHon4k/edit?usp=sharing might be easier to look at. The numbers under "Local mobilecoind" and "Remote mobilecoind" show how many out of how many iterations took less than a certain amount of time, e.g.
40/53 <2s
reads as 40 out of 53 iterations took less than 2 seconds).Includes time it takes to query fog ledger for rings and merkle proofs
The raw data is available here: https://gist.github.com/eranrund/8e89d5d8ad6b6d5c79d72a3e6011d1bb
So, it appears that at least in the dev network configuration this performs fine and will allow us to save costs.
Future room for improvement
TODO
fog-ledger
servers connect to a centralizedmobilecoind
and ensure things still work as expected.