Skip to content

ateom-microvm: stop paying a 50ms tick waiting for virtiofsd - #849

Merged
Zoe Zhao (zoez7) merged 1 commit into
agent-substrate:mainfrom
BenTheElder:microvm-virtiofsd-socket-wait
Aug 11, 2026
Merged

ateom-microvm: stop paying a 50ms tick waiting for virtiofsd#849
Zoe Zhao (zoez7) merged 1 commit into
agent-substrate:mainfrom
BenTheElder:microvm-virtiofsd-socket-wait

Conversation

@BenTheElder

Copy link
Copy Markdown
Collaborator

Restoring an actor rebuilds its virtio-fs plumbing before the guest can come back, and part of that is waiting for virtiofsd to bind its socket. The wait polled every 50ms while virtiofsd binds in single-digit milliseconds, so what it cost was decided by the interval rather than the work: every restore paid a full tick, measured at a flat 51ms each time, against 5-10ms for the bind mounts beside it. Two shares are started per restore, so it was paid twice.

Poll finely enough to notice instead, and pull the wait out into a helper so a test can pin the behavior rather than the constant.

  • Tests pass
  • Appropriate changes to documentation are included in the PR

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the socket waiting logic in StartVirtiofsd into a dedicated waitForSocket helper function and reduces the polling interval from 50ms to 1ms to improve restore times. It also adds comprehensive unit tests for this helper. The review feedback suggests replacing the use of time.After inside the polling loop with a reusable time.Ticker to prevent excessive memory allocations and garbage collection pressure due to the short 1ms interval.

Comment thread cmd/ateom-microvm/internal/kata/overlay_linux.go
Restoring an actor rebuilds its virtio-fs plumbing before the guest can come
back, and part of that is waiting for virtiofsd to bind its socket. The wait
polled every 50ms while virtiofsd binds in single-digit milliseconds, so what
it cost was decided by the interval rather than the work: every restore paid a
full tick, measured at a flat 51ms each time, against 5-10ms for the bind
mounts beside it. Two shares are started per restore, so it was paid twice.

Poll finely enough to notice instead, and pull the wait out into a helper so a
test can pin the behaviour rather than the constant.
@zoez7
Zoe Zhao (zoez7) merged commit e81e3ef into agent-substrate:main Aug 11, 2026
11 checks passed
@BenTheElder
Benjamin Elder (BenTheElder) deleted the microvm-virtiofsd-socket-wait branch August 11, 2026 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants