-
Notifications
You must be signed in to change notification settings - Fork 97
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
Use Zygote process #775
Use Zygote process #775
Conversation
61cad63
to
db471b3
Compare
a495cb8
to
eff8a9d
Compare
75c928e
to
1654ca5
Compare
This build on the changes from #774 The benchmark results show no change in performance w.r.t. the scheduled nightly runs: |
Signed-off-by: Jorge Prendes <[email protected]>
Signed-off-by: Jorge Prendes <[email protected]>
Signed-off-by: Jorge Prendes <[email protected]>
} | ||
|
||
let container = builder.as_init(&bundle).with_systemd(false).build()?; | ||
let (root, state) = Zygote::global() |
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.
Great, nice interface to use
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.
I would like to see the memory usage of this zygote process vs. the cloned shim process running containers
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.
Memory usage as reported by VmPeak
in /proc/xxx/status
Without zygote
Shim peak memory usage was: 3341772 kB
With zygote:
Shim peak memory usage was: 3342252 kB
Zygote peak memory usage was: 31056 kB
I am a bit surprised by the memory usage of the shim, I expected it to consume less memory.
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.
Revisiting the numbers, for wasmtime the shim peaks at ~19000 kB of resident memory with or without the zygote.
The zygote itself peaks at 5500kB of resident memory.
Signed-off-by: Jorge Prendes <[email protected]>
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.
This is really great work! Looking forward to seeing less sporadic CI failures 🚀
Do I understand correctly that the container creation would look like:
->shim
->zygote (cloned from shim)
-> container 1 (message sent from shim to zygote; cloned from zygote)
-> container 2 (message sent from shim to zygote; cloned from zygote)
Yes, that's correct. We could still see issues if we ever "pollute" the zygote. We do create an engine inside the zygote before cloning the process, and if that has global state, starts threads, etc, it can be a problem. Currently the engine struct for all our shims are very simple, so that's not an issue. I'm thinking on addressing that as part of the split engine-precompiler. |
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!
This PR introduces a zygote process (a very small process cloned early on during shim startup), from which new containers are created. This effectively decouples the global state of the shim from the state of the container process.
Fixes #755 and #357