Skip to content

Improve performance #433

Open
Open
@ludfjig

Description

@ludfjig

There is a lot of room to improve the performance of Hyperlight. Here are some ideas, roughly ordered by the amount of work required to implement them (from low to high):

  • Avoid unnecessary memory copies: Currently, we make many redundant memory copies when transferring data in and out of the guest. While we're using flatbuffers for serialization, we're not leveraging its full benefits. APIs such as call_guest_func should accept parameters by reference instead of by value, since the data needs to be serialized anyway.

  • Eliminate the per-sandbox hypervisor thread: We spawn a dedicated "hypervisor_handler" thread for each sandbox, which introduces significant context-switching overhead. If we can safely cancel a running VM's execution, we may be able to eliminate this thread entirely.

  • Snapshot and reuse initialized guests: When running the same guest binary across many sandboxes, we could significantly boost performance by allowing users to snapshot an initialized guest and create new guests from that snapshot. This would avoid the overhead of initializing each sandbox from scratch. By mapping the snapshot’s memory into the guest as read-only and using copy-on-write (COW) page faults, we could for example skip reloading the guest binary entirely.

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