Skip to content

Add API to create a Snapshot without going through creating a VM partition #1755

Open

Description

@jprendes

Ok, I think the way to go would be to add a new builder terminator snapshot_from_file and snapshot_from_bytes, and use those to benchmark all the setup that we were measuring for the uninitialized sandbox here (maybe except for the memory allocation and memcpy, but that's not a big loss).

I'll create an issue to add this and reintroduce the new benchmarks to compensate what we loose here.

Originally posted by @jprendes in #1746 (comment)

Activity

  1. syntactically commented on Aug 24, 2026

    @syntactically
    Member

    I'm not totally convinced this is a good idea, because the existence of uninitialized snapshots is kind of a nasty hack the way it is done now---I don't think there is ever a good use case for them. So, I've been thinking it might make sense to move towards needing a partition handle for snapshot creation so that we can do the initialize call inside of Snapshot::from_file.

  2. yoshuawuyts commented on Aug 24, 2026

    @yoshuawuyts
    Contributor

    Snapshot::from_file would also match the SandboxBuilder::from_file API discussed in #1748

  3. ludfjig commented on Aug 24, 2026

    @ludfjig
    Contributor

    Add API to create a Snapshot without going through creating a VM partition

    I also think we don't want this. It would be really nice if we can guarantee that all snapshots have gone through VM initialization. For benchmarking, then the only thing to track are

    1. Time to create an initialized snapshot (from binary) (this includes vm init time)
    2. Time to create a sandbox from initialized snapshot (this includes creating vm from scratch for disk-snapshot, and possibly for in-memory snapshtos as well)
  4. jprendes commented on Aug 24, 2026

    @jprendes
    ContributorAuthor

    Can do so the initializing when we create the sandbox from an uninitiated snapshot?

  5. ludfjig commented on Aug 24, 2026

    @ludfjig
    Contributor

    Can do so the initializing when we create the sandbox from an uninitiated snapshot?

    That's what we do right now

  6. syntactically commented on Oct 1, 2026

    @syntactically
    Member

    That's what we do right now

    It's what we do right now, but it's really annoying and makes the snapshot representation kind of non-uniform: any code that deals with it has to go check whether it is initialised or not and treat it differently. I agree with @ludfjig that it would be really nice to change so that

    [..] we can guarantee that all snapshots have gone through VM initialization

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions