[Tarantool-patches] [PATCH v1] Implement perf testing at gitlab-ci

Alexander V. Tikhonov avtikhon at tarantool.org
Wed Feb 12 10:22:48 MSK 2020


Added Tarantool benchmarking to Gitlab-CI, set it's
runs on "*-perf" named branches and 'master' branch.

Benchmarks run using scripts from repository:
  http://gitlab.com/tarantool/bench-run

Added Gitlab-CI job to run benchmarks:
- cbench
- linkbench
- nosqlbench (hash/tree Tarantool run modes)
- sysbench
- tpcc
- ycsb (hash/tree Tarantool run modes)

Perfomance testing run using docker image built
with docker files from bench-run repository.
---

Github: https://github.com/tarantool/tarantool/tree/avtikhon/gitlab-ci-perf

 .gitlab-ci.yml | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++
 .gitlab.mk     | 42 +++++++++++++++++++++++
 2 files changed, 135 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 727b7c94e..a2bb10a36 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,8 +1,12 @@
 stages:
   - test
+  - perf
+  - cleanup
 
 variables:
   GITLAB_MAKE: "make -f .gitlab.mk"
+  IMAGE_PERF: "${CI_REGISTRY}/${CI_PROJECT_PATH}/perf/ubuntu-bionic:perf_master"
+  IMAGE_PERF_BUILT: "${CI_REGISTRY}/${CI_PROJECT_PATH}/perf_tmp/ubuntu-bionic:perf_${CI_COMMIT_SHORT_SHA}"
 
 # Jobs templates
 
@@ -26,6 +30,11 @@ variables:
     - merge_requests
     - /^.*-full-ci$/
 
+.perf_only_template: &perf_only_definition
+  only:
+    - master
+    - /^.*-perf$/
+
 .docker_test_template: &docker_test_definition
   image: "${CI_REGISTRY}/${CI_PROJECT_PATH}/testing/debian-stretch:latest"
   stage: test
@@ -77,6 +86,13 @@ variables:
   after_script:
     - ${GITLAB_MAKE} vms_shutdown
 
+.perf_docker_test_template: &perf_docker_test_definition
+  <<: *perf_only_definition
+  image: ${IMAGE_PERF_BUILT}
+  stage: perf
+  tags:
+    - docker_perf
+
 # Tests
 
 release:
@@ -168,6 +184,83 @@ freebsd_12_release:
   script:
     - ${GITLAB_MAKE} vms_test_freebsd
 
+# Perf
+
+perf_bootstrap:
+  <<: *perf_only_definition
+  stage: test
+  tags:
+    - perf
+  script:
+    - ${GITLAB_MAKE} docker_perf_bootstrap
+
+perf_sysbench:
+  <<: *perf_docker_test_definition
+  script:
+    - ${GITLAB_MAKE} perf_sysbench
+
+perf_tpcc:
+  <<: *perf_docker_test_definition
+  script:
+    - ${GITLAB_MAKE} perf_tpcc
+
+perf_ycsb_hash:
+  <<: *perf_docker_test_definition
+  variables:
+    TYPE: 'hash'
+  script:
+    - ${GITLAB_MAKE} perf_ycsb
+
+perf_ycsb_tree:
+  <<: *perf_docker_test_definition
+  variables:
+    TYPE: 'tree'
+  script:
+    - ${GITLAB_MAKE} perf_ycsb
+
+perf_nosqlbench_hash:
+  <<: *perf_docker_test_definition
+  variables:
+    TYPE: 'hash'
+  script:
+    - ${GITLAB_MAKE} perf_nosqlbench
+
+perf_nosqlbench_tree:
+  <<: *perf_docker_test_definition
+  variables:
+    TYPE: 'tree'
+  script:
+    - ${GITLAB_MAKE} perf_nosqlbench
+
+perf_cbench:
+  <<: *perf_docker_test_definition
+  script:
+    - ${GITLAB_MAKE} perf_cbench
+
+# TODO: need to tune the docker memory size
+#perf_linkbench:
+#  <<: *perf_docker_test_definition
+#  tags:
+#    - docker_perf_hdd
+#  script:
+#    - ${GITLAB_MAKE} perf_linkbench
+
+perf_linkbench_ssd:
+  <<: *perf_docker_test_definition
+  tags:
+    - docker_perf_ssd
+  script:
+    - ${GITLAB_MAKE} perf_linkbench
+
+remove_images:
+  <<: *perf_only_definition
+  stage: cleanup
+  when: always
+  tags:
+    - perf
+  script:
+    - ${GITLAB_MAKE} docker_perf_tmp_image_remove
+
 # Packs
 
 centos_6:
diff --git a/.gitlab.mk b/.gitlab.mk
index 24b18b7f2..c84f74a64 100644
--- a/.gitlab.mk
+++ b/.gitlab.mk
@@ -41,6 +41,7 @@ test_%_no_deps: git_submodule_update
 
 GITLAB_REGISTRY?=registry.gitlab.com
 DOCKER_BUILD=docker build --network=host -f - .
+DOCKERFILE_BUILD=docker build --network=host
 
 define DEBIAN_STRETCH_DOCKERFILE
 FROM packpack/packpack:debian-stretch
@@ -78,6 +79,25 @@ docker_bootstrap:
 	docker push ${DEBIAN_STRETCH_IMAGE}:latest
 	docker push ${DEBIAN_BUSTER_IMAGE}:latest
 
+docker_perf_bootstrap:
+	git clone https://github.com/tarantool/bench-run.git
+	docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} \
+		${CI_REGISTRY}
+	# build all benchmarks w/o depends on Tarantool sources
+	${DOCKERFILE_BUILD} --add-host $(shell hostname):127.0.0.1 \
+		-t ${IMAGE_PERF} -f bench-run/dockerfiles/ubuntu_benchs .
+	docker push ${IMAGE_PERF}
+	# build Tarantool and benchmarks with depends on Tarantool sources
+	${DOCKERFILE_BUILD} --build-arg image_from=${IMAGE_PERF} \
+		-t ${IMAGE_PERF_BUILT} -f bench-run/dockerfiles/ubuntu_tnt .
+	docker push ${IMAGE_PERF_BUILT}
+
+# #####################################################
+# Remove temporary performance image from the test host
+# #####################################################
+docker_perf_tmp_image_remove:
+	docker rmi --force ${IMAGE_PERF_BUILT}
+
 # #################################
 # Run tests under a virtual machine
 # #################################
@@ -126,3 +146,25 @@ deploy: package
 
 static_build:
 	docker build --network=host --build-arg RUN_TESTS="${RUN_TESTS}" -f Dockerfile.staticbuild .
+
+# ###################
+# Performance testing
+# ###################
+
+perf_sysbench:
+	/opt/bench-run/sysbench/run.sh
+
+perf_tpcc:
+	/opt/bench-run/tpcc/run.sh
+
+perf_ycsb:
+	/opt/bench-run/ycsb/run.sh ${TYPE} ${RUNS}
+
+perf_nosqlbench:
+	/opt/bench-run/nosqlbench/run.sh ${TYPE}
+
+perf_cbench:
+	/opt/bench-run/cbench/run.sh
+
+perf_linkbench:
+	/opt/bench-run/linkbench/run.sh
-- 
2.17.1



More information about the Tarantool-patches mailing list