Skip to content

Commit

Permalink
feat: strengthen resources rate-limiting
Browse files Browse the repository at this point in the history
  • Loading branch information
angristan committed Jul 28, 2021
1 parent 2008db4 commit d494c9c
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions options.go
Expand Up @@ -25,6 +25,19 @@ func getFirecrackerConfig() (firecracker.Config, error) {
PathOnHost: firecracker.String("../agent/rootfs.ext4"),
IsRootDevice: firecracker.Bool(true),
IsReadOnly: firecracker.Bool(false),
RateLimiter: firecracker.NewRateLimiter(
// bytes/s
models.TokenBucket{
OneTimeBurst: firecracker.Int64(1024 * 1024), // 1 MiB/s
RefillTime: firecracker.Int64(500), // 0.5s
Size: firecracker.Int64(1024 * 1024),
},
// ops/s
models.TokenBucket{
OneTimeBurst: firecracker.Int64(100), // 100 iops
RefillTime: firecracker.Int64(1000), // 1s
Size: firecracker.Int64(100),
}),
}},
NetworkInterfaces: []firecracker.NetworkInterface{{
// Use CNI to get dynamic IP
Expand All @@ -34,9 +47,9 @@ func getFirecrackerConfig() (firecracker.Config, error) {
},
}},
MachineCfg: models.MachineConfiguration{
VcpuCount: firecracker.Int64(2),
VcpuCount: firecracker.Int64(1),
HtEnabled: firecracker.Bool(true),
MemSizeMib: firecracker.Int64(512),
MemSizeMib: firecracker.Int64(256),
},
}, nil
}
Expand Down

0 comments on commit d494c9c

Please sign in to comment.