github.com/containerd/containerd@v22.0.0-20200918172823-438c87b8e050+incompatible/contrib/aws/snapshotter_bench_readme.md (about) 1 ## Requirements 2 3 ### Running 4 Due to its dependency on `dmsetup`, executing the snapshotter process in an environment where a udev 5 daemon is not accessible (such as a container) may result in unexpected behavior. In this case, try executing the 6 snapshotter with the `DM_DISABLE_UDEV=1` environment variable, which tells `dmsetup` to ignore udev and manage devices 7 itself. See [lvm(8)](http://man7.org/linux/man-pages/man8/lvm.8.html) and 8 [dmsetup(8)](http://man7.org/linux/man-pages/man8/dmsetup.8.html) for more information. 9 10 ## How to run snapshotters benchmark 11 12 - `containerd` project contains AWS CloudFormation template to run an EC2 instance suitable for benchmarking. 13 It installs dependencies, prepares EBS volumes with same performance characteristics, and creates thin-pool device. 14 You can make stack with the following command (note: there is a charge for using AWS resources): 15 16 ```bash 17 aws cloudformation create-stack \ 18 --stack-name benchmark-instance \ 19 --template-body file://benchmark_aws.yml \ 20 --parameters \ 21 ParameterKey=Key,ParameterValue=SSH_KEY \ 22 ParameterKey=SecurityGroups,ParameterValue=sg-XXXXXXXX \ 23 ParameterKey=VolumesSize,ParameterValue=20 \ 24 ParameterKey=VolumesIOPS,ParameterValue=1000 25 ``` 26 27 - You can find an IP address of newly created EC2 instance in AWS Console or via AWS CLI: 28 29 ```bash 30 $ aws ec2 describe-instances \ 31 --instance-ids $(aws cloudformation describe-stack-resources --stack-name benchmark-instance --query 'StackResources[*].PhysicalResourceId' --output text) \ 32 --query 'Reservations[*].Instances[*].PublicIpAddress' \ 33 --output text 34 ``` 35 36 - SSH to an instance and prepare `containerd`: 37 38 ```bash 39 ssh -i SSH_KEY ec2-user@IP 40 mkdir /mnt/disk1/data /mnt/disk2/data /mnt/disk3/data 41 go get github.com/containerd/containerd 42 cd $(go env GOPATH)/src/github.com/containerd/containerd 43 make 44 ``` 45 46 - Now you're ready to run the benchmark: 47 48 ```bash 49 sudo su - 50 cd snapshots/benchsuite/ 51 go test -bench . \ 52 -dm.thinPoolDev=bench-docker--pool \ 53 -dm.rootPath=/mnt/disk1/data \ 54 -overlay.rootPath=/mnt/disk2/data \ 55 -native.rootPath=/mnt/disk3/data 56 ``` 57 58 - The output will look like: 59 60 ```bash 61 goos: linux 62 goarch: amd64 63 pkg: github.com/containerd/containerd/snapshots/testsuite 64 65 BenchmarkOverlay/run-4 1 1019730210 ns/op 164.53 MB/s 66 BenchmarkOverlay/prepare 1 26799447 ns/op 67 BenchmarkOverlay/write 1 968200363 ns/op 68 BenchmarkOverlay/commit 1 24582560 ns/op 69 70 BenchmarkDeviceMapper/run-4 1 3139232730 ns/op 53.44 MB/s 71 BenchmarkDeviceMapper/prepare 1 1758640440 ns/op 72 BenchmarkDeviceMapper/write 1 1356705388 ns/op 73 BenchmarkDeviceMapper/commit 1 23720367 ns/op 74 75 PASS 76 ok github.com/containerd/containerd/snapshots/testsuite 185.204s 77 ``` 78 79 - Don't forget to tear down the stack so it does not continue to incur charges: 80 81 ```bash 82 aws cloudformation delete-stack --stack-name benchmark-instance 83 ```