Skip to content

Commit 8ed3e4a

Browse files
committed
doc(vhost-user-blk): add performance considerations
Mention memfd page fault overhead and host pagecache usage for virtio block devices compared to vhost-user. Signed-off-by: Nikita Kalyazin <[email protected]>
1 parent 2c200e4 commit 8ed3e4a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

docs/api_requests/block-vhost-user.md

+22
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,28 @@ be coming from the fact that the custom logic is implemented in the same process
7474
that handles Virtio queues, which reduces the number of required context
7575
switches.
7676

77+
## Disadvantages
78+
79+
In order for the backend to be able to process virtio requests, guest memory
80+
needs to be shared by the frontend to the backend. This means, a shared memory
81+
mapping is required to back guest memory. When a vhost-user device is
82+
configured, Firecracker uses `memfd_create` instead of creating an anonymous
83+
private mapping to achieve that. It was observed that page faults to a shared
84+
memory mapping take significantly longer (up to 24% in our testing), because
85+
Linux memory subsystem has to use atomic memory operations to update page
86+
status, which is an expensive operation under specific conditions. We advise
87+
users to profile performance on their workloads when considering to use
88+
vhost-user devices.
89+
90+
## Other considerations
91+
92+
Compared to virtio block device where Firecracker interacts with a drive file on
93+
the host, vhost-user block device is handled by the backend directly. Some
94+
workloads may benefit from caching and readahead that the host pagecache offers
95+
for the backing file. This benefit is not available in vhost-user block case.
96+
Users may need to implement internal caching within the backend if they find it
97+
appropriate.
98+
7799
## Backends
78100

79101
There are a number of open source implementations of a vhost-user backend

0 commit comments

Comments
 (0)