Skip to content

Commit a69144e

Browse files
acatangiualxiord
authored andcommitted
Update README with rate-limiter, metrics and jailer info (v0.5.0)
Signed-off-by: Adrian Catangiu <[email protected]>
1 parent c005c71 commit a69144e

File tree

1 file changed

+44
-3
lines changed

1 file changed

+44
-3
lines changed

README.md

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ The **API endpoint** can be used to:
4747
- Emulated keyboard (i8042) and serial console (UART). The microVM serial
4848
console input and output are connected to those of the Firecracker process
4949
(this allows direct console access to the guest OS).
50+
- Metrics currently logged every 60s to the configured log-file.
51+
Categories:
52+
- API requests related metrics
53+
- VCPUs related metrics
54+
- Device emulation related metrics:
55+
- The serial console (UART)
56+
- Keyboard (i8042)
57+
- Block
58+
- Network
59+
- Seccomp filtering related metrics
5060
- Default demand fault paging & CPU oversubscription.
5161

5262
## Performance
@@ -105,6 +115,8 @@ name.
105115
If the api socket is not specified at startup, Firecracker will create
106116
/tmp/firecracker.socket.
107117

118+
Firecracker can be started in a jail as described in `docs/jailer.md`.
119+
108120
### Configure the MicroVM
109121

110122
The MicroVM is configured via the `machine-config/` API resource.
@@ -129,12 +141,37 @@ Firecracker expects network interfaces and drives to be created beforehand and
129141
passed by name. Ensure Firecracker will have the required permissions to open
130142
these resources.
131143

132-
For example, if using a TUN/TAP device, you will need to create it beforehand,
133-
and then call the `/network-interfaces` API resource with its name:
144+
Both network and block support IO rate limiting. This is done by using the `rate_limiter`
145+
optional field(s) in the device setup API call.
146+
147+
Limits are defined by configuring each of the `bandwidth` and `ops` token buckets.
148+
A token bucket is defined by configurable `size` and `refill_time` (milliseconds).
149+
150+
The bucket _refill-rate_ is derived from `size` and `refill_time`, and it is the constant
151+
rate at which the tokens replenish.
152+
Consumption from the token bucket is unbounded in speed which allows for bursts
153+
bound in size by the amount of tokens available.
154+
Once the token bucket is empty, consumption speed is bound by the _refill_rate_.
155+
156+
A token bucket with either `size == 0` or `refill_time == 0` will be inactive/unlimited.
157+
Tokens are `bytes` for _bandwidth limiting_ and `operations` for _ops/s limiting_, and
158+
time is specified in milliseconds.
159+
160+
For example, if using a TUN/TAP device, you will need to create it beforehand:
161+
134162
```bash
135163
sudo ip tuntap add name vmtap33 mode tap
136164
sudo ifconfig vmtap33 192.168.241.1/24 up
137-
165+
```
166+
And then call the `/network-interfaces` API resource with its name and desired properties:
167+
- Interface ID is `1`
168+
- Host device is `vmtap33`
169+
- Guest mac is `06:00:00:00:00:01`
170+
- RX _Bandwith_ rate limit is `100 MBps` and _Ops/s_ rate is unlimited
171+
- (`100 MBps` example token bucket `size = 100.000.000 bytes` and `refill_time = 1000 milliseconds` )
172+
- No TX rate limiting of any kind
173+
- State is `attached`
174+
```bash
138175
curl --unix-socket /tmp/firecracker.socket -i \
139176
-X PUT "http://localhost/network-interfaces/1" \
140177
-H "accept: application/json" \
@@ -143,6 +180,10 @@ curl --unix-socket /tmp/firecracker.socket -i \
143180
\"iface_id\": \"1\",
144181
\"host_dev_name\": \"vmtap33\",
145182
\"guest_mac\": \"06:00:00:00:00:01\",
183+
\"rx_rate_limiter\": {
184+
\"bandwidth\": { \"size\": 100000000, \"refill_time\": 1000 },
185+
\"ops\": { \"size\": 0, \"refill_time\": 0 }
186+
},
146187
\"state\": \"Attached\"
147188
}"
148189
```

0 commit comments

Comments
 (0)