Skip to content
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

improves the drain-accounts script so that it funds more accounts #1988

Closed
wants to merge 2 commits into from

Conversation

cbeck88
Copy link
Contributor

@cbeck88 cbeck88 commented May 17, 2022

this was requested by the sdk teams to simplify testing

we could also actually mint to 500 accounts, but mobilecoind gets
noticeably slower as we add more accounts to monitor, so instead
we went with this pay-round-robin approach

@cbeck88 cbeck88 requested review from a team and iamalwaysuncomfortable May 17, 2022 19:36
this was requested by the sdk teams to simplify testing

we could also actually mint to 500 accounts, but mobilecoind gets
noticeably slower as we add more accounts to monitor, so instead
we went with this pay-round-robin approach
@cbeck88
Copy link
Contributor Author

cbeck88 commented May 17, 2022

This is working but it is very slow, it seems like it's going to take an hour

https://deploybot.development-eu1.mobilecoin.com/blue/organizations/jenkins/mobilecoin-internal/detail/deploy%2Fdiogenes/38/pipeline/

I wonder if there is some way to increase the parallelism here or something

@eranrund
Copy link
Contributor

This is working but it is very slow, it seems like it's going to take an hour

https://deploybot.development-eu1.mobilecoin.com/blue/organizations/jenkins/mobilecoin-internal/detail/deploy%2Fdiogenes/38/pipeline/

I wonder if there is some way to increase the parallelism here or something

Maybe somehow leverage the fact that we can have up to 16 outputs?

Copy link
Contributor

@iamalwaysuncomfortable iamalwaysuncomfortable left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's ways to use async even with sync code - some degree of collaborative multitasking could speed up the loop without creating too many extra accounts.

Comment on lines +146 to +149
num_dest = len(dest_addresses)
num_src = args.num_src_accounts or len(source_accounts)
for i, dest in enumerate(dest_addresses):
src_account = source_accounts[i % num_src]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re:

This is working but it is very slow, it seems like it's going to take an hour

In addition to Eran's comment of leveraging up to 16 outputs. Some of this could be done asyncronously - even though the code is fundamentally synchronous you can still use async collaborative multi-tasking with sync code with this: https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.run_in_executor

we could also actually mint to 500 accounts, but mobilecoind gets noticeably slower as we add more accounts to monitor,

At what point does that start happening? If just a few more source accounts doesn't slow it down. We could go through this with a queue of like 5 accounts sending & awaiting and probably have a significant speedup.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it interests you - I can give that a shot.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either way should achieve greater concurrency

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the problem is that, there is only one thread in mobilecoind, so even if we make more requests to it in parallel they are all going to be serialized

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this line means there is exactly one thread in the grpcio thread-pool for handling rpc requests

Yeah that's their "completion queue" object which does indeed wait for calls to return before returning the data. @remoun since you're with gRPC internals - what do you think the consequences of extending the CQ thread count might be?

I don't think there's a set versioning for McD right like there is for full service? Exchanges track main? If that's the okay It might be possible to maybe create an unstable branch which mainly tracks main but has a few unstable, but extremely useful features we can use in cases like this. That's maybe a bit cursed of a strategy but would also open up a good deal of flexibility for us.

How much work would #4 be do you think? It may be something do-able for 1.3.0 - like we just go with Eran's suggestion for this round and get ahead with FOG distro for the next release/intermediate testing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this line means there is exactly one thread in the grpcio thread-pool for handling rpc requests

Yeah that's their "completion queue" object which does indeed wait for calls to return before returning the data. @remoun since you're with gRPC internals - what do you think the consequences of extending the CQ thread count might be?

Like you mentioned, it creates additional gRPC worker threads. While that would definitely improve throughput, it could also reveal data races or other multi-threading issues, so we should approach that carefully and take the time to test it thoroughly.

I don't think there's a set versioning for McD right like there is for full service? Exchanges track main? If that's the okay It might be possible to maybe create an unstable branch which mainly tracks main but has a few unstable, but extremely useful features we can use in cases like this. That's maybe a bit cursed of a strategy but would also open up a good deal of flexibility for us.

I don't see how that branch strategy would work, while we develop against master. Am I missing something?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how that branch strategy would work, while we develop against master. Am I missing something?

I'm not sure what version of MobilecoinD exchanges still using it use since it doesn't seemed to be versioned like Full Service. Maybe they just track the overall releases like 1.2.0/1.3.0 etc?

The branch strategy would be one alternative to alternative to enable potentially unsafe features we only need for testing. The branch would consistently track master, but be able to contain a few extra, potentially unsafe features we need for testing like increasing the cq count.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem like reasonable strategy to me. In my opinion, we either have faith in the code we build or we don't. Having a branch that has stuff in it that seems to work but we don't trust it enough to actually stand behind it will likely result in a stale branch that no-one remembers to update until they are forced to, and then they have to dig into whatever potential issues lives there. We should strive to to reduce the amounts of hacks and workarounds that we do, even for internal testing.

I think the main issue with increasing the RPC worker threads for mobilecoind would show up with the endpoints that do UTXO selection as that could result in the same UTXOs being selected for multiple transactions. For users that explicitly manage their UTXOs and feed in the ones they want to spend explicitly, I think it should be fine, but like @remoun said we should approach this carefully.

I think trying out the multiple-outputs txs as well as evolving fog-distro are viable paths forward. I do think that we should start treating fog-distro like a first class citizen in our codebase, since realistically if it breaks our ability to make progress slows down or halts.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd also vote for fog-distro as a first class citizen. Testing with mobilecoind has been a hacky (albeit necessary) process which has lead to "tradeoff hell" more than once it seems. Making decisions under release pressure about how to change mobilecoind doesn't lead to the best design/maintenance decisions for it.

Fog-distro updates promise to result in a much cleaner process and allow us to add testing features strictly in the domain of exercising integration tests.

What would we need to change about FOG distro to make it suit our needs?

@cbeck88 cbeck88 marked this pull request as draft May 23, 2022 20:03
@cbeck88
Copy link
Contributor Author

cbeck88 commented Jun 3, 2022

I think I'm going to close this in favor of: #2061

@cbeck88 cbeck88 closed this Jun 3, 2022
@cbeck88 cbeck88 deleted the improve-drain-accounts branch July 18, 2022 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants