Skip to content

Commit c69fe28

Browse files
docs: document threaded block and multiqueue
Describe threaded processing, multiqueue limits, and worker resources. Document seccomp requirements and partial updates across queues. Signed-off-by: Pierre Bertholom <pbertho@amazon.com>
1 parent 2d61a32 commit c69fe28

2 files changed

Lines changed: 47 additions & 1 deletion

File tree

‎docs/api_requests/patch-block.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ guest driver which will update the size of the raw block device. With that being
1919
said, a sequence which performs resizing/altering of the block underlying host
2020
file followed by a PATCH /drives API call is not an atomic operation as the
2121
guest can also modify the block file via emulation during the sequence, if the
22-
raw block device is mounted or accessible.
22+
raw block device is mounted or accessible. Multiqueue follows the same update
23+
path, but Firecracker updates each queue separately, so in-flight I/O can
24+
observe a partially updated device.
2325

2426
### Supported use case
2527

‎docs/block.md‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,50 @@ The `io_engine` field selects the host-side IO backend:
9191

9292
See [block-io-engine.md](api_requests/block-io-engine.md) for more information.
9393

94+
### Threaded Mode and Multiqueue
95+
96+
By default, Firecracker processes block requests on the VMM thread and exposes
97+
one queue for each drive. Set `threaded` to `true` to process each queue on a
98+
dedicated host worker thread. Threaded mode supports both the `Sync` and `Async`
99+
IO engines. This moves block processing off the VMM thread. Multiple queues let
100+
Firecracker process requests from separate queues in parallel.
101+
102+
The `num_queues` field sets the number of queues that Firecracker exposes to the
103+
guest. Its default value is `1`. A value greater than `1` enables virtio-blk
104+
multiqueue and requires `threaded` to be `true`. The queue count cannot exceed
105+
the configured vCPU count. Firecracker also rejects a machine configuration
106+
update that would reduce the vCPU count below an existing drive's queue count.
107+
108+
Firecracker creates one worker thread for each configured queue, including
109+
queues that the guest does not use. All queues share the drive's rate limiter,
110+
so its limits apply to the total traffic for the drive.
111+
112+
Each worker thread is named `fc_q<index>_<drive_id>`, for example `fc_q0_data`.
113+
Linux limits thread names to 15 bytes, so longer names are truncated in tools
114+
that read the kernel thread name (`top`, `ps`, `perf`, ...). The queue index
115+
comes first so truncation applies to the end of the `drive_id`. Drives whose
116+
`drive_id` share a long prefix might still collide. Firecracker logs keep the
117+
full name. To keep names distinct across drives, use a `drive_id` of at most 9
118+
bytes when using up to 10 queues, and at most 8 bytes for more than 10 queues.
119+
120+
The following configuration creates a drive with 4 queues and 4 worker threads:
121+
122+
```json
123+
{
124+
"drive_id": "data",
125+
"path_on_host": "./data.ext4",
126+
"is_root_device": false,
127+
"is_read_only": false,
128+
"threaded": true,
129+
"num_queues": 4
130+
}
131+
```
132+
133+
The microVM must have at least 4 vCPUs before Firecracker accepts this drive. If
134+
a custom seccomp filter is used, it must include the `blk_worker` thread
135+
category described in the
136+
[seccompiler documentation](seccompiler.md#json-file-format).
137+
94138
### Read-only Devices
95139

96140
Setting `is_read_only` to `true` causes Firecracker to open the backing file

0 commit comments

Comments
 (0)