Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

PVF: instantiate runtime from bytes #7266

@mrcnski

Description

@mrcnski

ISSUE

Overview

Create the runtime from artifact bytes instead of a file using create_runtime_from_artifact_bytes.

This is a prerequisite for #7243 to be able to lock down filesystem access for PVF threads.

Performance Note

This should not affect performance for Linux, but instantiation will be slower on Mac:

/// * Linux - this feature is supported for all instances of [`Module`].
///   Modules backed by an existing mmap (such as those created by
///   [`Module::deserialize_file`]) will reuse that mmap to cow-initialize
///   memory. Other instance of [`Module`] may use the `memfd_create`
///   syscall to create an initialization image to `mmap`.
/// * Unix (not Linux) - this feature is only supported when loading modules
///   from a precompiled file via [`Module::deserialize_file`] where there
///   is a file descriptor to use to map data into the process. Note that
///   the module must have been compiled with this setting enabled as well.

Benchmarks comparing without and with CoW:

dirty_1mb_of_memory_from_kusama_runtime_with_pooling_vanilla_precompiled_on_1_threads
                        time:   [115.87 µs 116.94 µs 118.24 µs]
dirty_1mb_of_memory_from_kusama_runtime_with_pooling_vanilla_precompiled_on_2_threads
                        time:   [184.43 µs 185.03 µs 185.63 µs]
dirty_1mb_of_memory_from_kusama_runtime_with_pooling_vanilla_precompiled_on_4_threads
                        time:   [312.80 µs 314.64 µs 316.68 µs]
dirty_1mb_of_memory_from_kusama_runtime_with_pooling_vanilla_precompiled_on_8_threads
                        time:   [724.69 µs 729.18 µs 733.92 µs]

dirty_1mb_of_memory_from_kusama_runtime_with_pooling_cow_precompiled_on_1_threads
                        time:   [79.791 µs 80.350 µs 81.036 µs]
dirty_1mb_of_memory_from_kusama_runtime_with_pooling_cow_precompiled_on_2_threads
                        time:   [98.265 µs 98.738 µs 99.264 µs]
dirty_1mb_of_memory_from_kusama_runtime_with_pooling_cow_precompiled_on_4_threads
                        time:   [135.45 µs 137.78 µs 140.80 µs]
dirty_1mb_of_memory_from_kusama_runtime_with_pooling_cow_precompiled_on_8_threads
                        time:   [536.39 µs 540.40 µs 544.44 µs]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions