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

Can we reduce the startup time of the sapphire-dev container? #411

Open
3 of 4 tasks
CedarMist opened this issue Aug 9, 2023 · 2 comments
Open
3 of 4 tasks

Can we reduce the startup time of the sapphire-dev container? #411

CedarMist opened this issue Aug 9, 2023 · 2 comments
Assignees

Comments

@CedarMist
Copy link
Member

CedarMist commented Aug 9, 2023

Currently with the mock backend it takes about a minute for sapphire-dev container to start on my laptop.

Ideally it should take less time, so it's worth doing some investigation to determine why it takes so long.

We probably shouldn't try things blindly, and instead try to instrument the container startup.

Some options are (unsure if they would make any difference):

  • Reduce logging? (maybe disk I/O is causing delays?)
  • Run only 1 compute node if possible.
  • Removing additional sleeps
  • Provision less accounts

There are ways of tracking startup time (e.g. a flame graph) which could be useful:

@ptrus
Copy link
Member

ptrus commented Aug 9, 2023

Could you post some logs (with timestamps) of the startup part. I assume it would be somewhat easy to see what steps are using most of the time and how realistically it is reducing it down.

Reduce logging? (maybe disk I/O is causing delays?)

Most likely not the case.

Run only 1 compute node if possible.

Yeah should be possible and easy to setup via the fixture (I think the default uses 3 compute nodes).

Provision less accounts

How many accounts are currently provisioned? I assume all accounts are provisioned from the same "seed account" so it can only provision one new account per runtime block, so this could indeed slow the startup down. This could be optimized.


Some more ideas:

  • if we find out there's no way to meaningfully reduce the startup-time further, the start-up phase could be moved into the build step of the docker container. We could, as part of the docker build phase, start and initialize the network state. On container startup it would then just need to resume the already initialized network - which should be fast (note that the oasis-node net-runner does already support this - resuming an already provisioned network).

  • related to the above. Make the container non-ephemeral. With some updates the container could persist state across restarts, removing the need to re-provision/initialize the network on every restart.

@CedarMist CedarMist self-assigned this Aug 10, 2023
@CedarMist
Copy link
Member Author

I tend to run the containers with --rm otherwise I end up with a bazillion previously used Docker containers which makes it difficult to prune unused stuff in the docker cache.

I will focus on reducing initial startup time, reducing compute nodes to 1, provision less accounts (I'm doing 20, can reduce to 5). And see if anything else stands out as easy wins first before moving onto anything more in-depth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants