Micro benchmarks for containerd. (#244)

This is the first in a series of micro benchmarks for containerd.
Performance measurement will use containerd objects and methods
that are not dependent on the grpc API and dont require the daemon
to the running. Test will require containerd-shim and runc.

The motivation is to understand the baseline performance at the lowest
containerd layer. A natural extension to this effort would be to write
macro benchmarks which would include API and daemon.

Note:
- Currently measures only one workload (busybox sh) start times. Will
add other bundles and args soon.
- Can use integration-test utils for bundle processing. However, json
marshal/unmarshal is currently timing out standard benchmark times. So
going with default spec for now.

Sample run:
BenchmarkBusyboxSh-4    / # / # / #        2     576013841 ns/op
ok      github.com/docker/containerd/runtime    1.800s

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
This commit is contained in:
Anusha Ragunathan 2016-05-27 10:35:42 -07:00 committed by Michael Crosby
parent 7fa8fc1477
commit 24144682a0
5 changed files with 265 additions and 41 deletions

View file

@ -18,8 +18,8 @@ ifeq ($(INTERACTIVE), 1)
DOCKER_FLAGS += -t
endif
TEST_ARTIFACTS_DIR := integration-test/test-artifacts
BUNDLE_ARCHIVES_DIR := $(TEST_ARTIFACTS_DIR)/archives
TESTBENCH_ARTIFACTS_DIR := output/test-artifacts
TESTBENCH_BUNDLE_DIR := $(TESTBENCH_ARTIFACTS_DIR)/archives
DOCKER_IMAGE := containerd-dev$(if $(GIT_BRANCH),:$(GIT_BRANCH))
DOCKER_RUN := docker run --privileged --rm -i $(DOCKER_FLAGS) "$(DOCKER_IMAGE)"
@ -35,7 +35,7 @@ bin:
mkdir -p bin/
clean:
rm -rf bin
rm -rf bin && rm -rf output
client: bin
cd ctr && go build -ldflags "${LDFLAGS}" -o ../bin/ctr
@ -55,18 +55,21 @@ shim: bin
shim-static:
cd containerd-shim && go build -ldflags "-w -extldflags -static ${LDFLAGS}" -tags "$(BUILDTAGS)" -o ../bin/containerd-shim
$(BUNDLE_ARCHIVES_DIR)/busybox.tar:
@mkdir -p $(BUNDLE_ARCHIVES_DIR)
curl -sSL 'https://github.com/jpetazzo/docker-busybox/raw/buildroot-2014.11/rootfs.tar' -o $(BUNDLE_ARCHIVES_DIR)/busybox.tar
$(TESTBENCH_BUNDLE_DIR)/busybox.tar:
mkdir -p $(TESTBENCH_BUNDLE_DIR)
curl -sSL 'https://github.com/jpetazzo/docker-busybox/raw/buildroot-2014.11/rootfs.tar' -o $(TESTBENCH_BUNDLE_DIR)/busybox.tar
bundles-rootfs: $(BUNDLE_ARCHIVES_DIR)/busybox.tar
bundles-rootfs: $(TESTBENCH_BUNDLE_DIR)/busybox.tar
dbuild: $(BUNDLE_ARCHIVES_DIR)/busybox.tar
dbuild: $(TESTBENCH_BUNDLE_DIR)/busybox.tar
@docker build --rm --force-rm -t "$(DOCKER_IMAGE)" .
dtest: dbuild
$(DOCKER_RUN) make test
dbench: dbuild
$(DOCKER_RUN) make bench
install:
cp bin/* /usr/local/bin/
@ -82,14 +85,16 @@ lint:
shell: dbuild
$(DOCKER_RUN) bash
test: validate
go test -v $(shell go list ./... | grep -v /vendor | grep -v /integration-test)
test: validate install bundles-rootfs
go test -bench=. -v $(shell go list ./... | grep -v /vendor | grep -v /integration-test)
ifneq ($(wildcard /.dockerenv), )
$(MAKE) install bundles-rootfs
cd integration-test ; \
go test -check.v -check.timeout=$(TEST_TIMEOUT) timeout=$(TEST_SUITE_TIMEOUT) $(TESTFLAGS) github.com/docker/containerd/integration-test
endif
bench: shim validate install bundles-rootfs
go test -bench=. -v $(shell go list ./... | grep -v /vendor | grep -v /integration-test)
validate: fmt
uninstall: