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

Alexander V. Tikhonov avtikhon at tarantool.org
Thu Feb 13 14:30:04 MSK 2020


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

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

Added Gitlab-CI jobs to run benchmarks:
- cbench
- linkbench
- nosqlbench with hash Tarantool run mode
- nosqlbench with tree Tarantool run mode
- sysbench
- tpcc
- ycsb with hash Tarantool run mode
- ycsb with tree Tarantool run mode

Perfomance testing uses docker images, built
with docker files from bench-run repository:
- perf/ubuntu-bionic:perf_master
    image with only built benchmarks
- perf_tmp/ubuntu-bionic:perf_<commit_SHA>
    images with Tarantool sources and depends
    benchmarks like 'cbench'
---

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

Changes v2:
- moved performance variables from global setup
  to performance template
- updated commit message
- added more comments to sources

 .gitlab-ci.yml | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++
 .gitlab.mk     | 53 +++++++++++++++++++++++++++
 2 files changed, 151 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 727b7c94e..bbf58ba79 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,5 +1,7 @@
 stages:
   - test
+  - perf
+  - cleanup
 
 variables:
   GITLAB_MAKE: "make -f .gitlab.mk"
@@ -26,6 +28,14 @@ variables:
     - merge_requests
     - /^.*-full-ci$/
 
+.perf_only_template: &perf_only_definition
+  only:
+    - master
+    - /^.*-perf$/
+  variables: &perf_vars_definition
+    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}"
+
 .docker_test_template: &docker_test_definition
   image: "${CI_REGISTRY}/${CI_PROJECT_PATH}/testing/debian-stretch:latest"
   stage: test
@@ -77,6 +87,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 +185,87 @@ 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:
+    <<: *perf_vars_definition
+    TYPE: 'hash'
+  script:
+    - ${GITLAB_MAKE} perf_ycsb
+
+perf_ycsb_tree:
+  <<: *perf_docker_test_definition
+  variables:
+    <<: *perf_vars_definition
+    TYPE: 'tree'
+  script:
+    - ${GITLAB_MAKE} perf_ycsb
+
+perf_nosqlbench_hash:
+  <<: *perf_docker_test_definition
+  variables:
+    <<: *perf_vars_definition
+    TYPE: 'hash'
+  script:
+    - ${GITLAB_MAKE} perf_nosqlbench
+
+perf_nosqlbench_tree:
+  <<: *perf_docker_test_definition
+  variables:
+    <<: *perf_vars_definition
+    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..fd91bef02 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,36 @@ docker_bootstrap:
 	docker push ${DEBIAN_STRETCH_IMAGE}:latest
 	docker push ${DEBIAN_BUSTER_IMAGE}:latest
 
+# #########################################################
+# Prepare 2 images for performance testings:
+# - perf/ubuntu-bionic:perf_master
+#   image with only built benchmarks w/o Tarantool sources,
+#   image rare changed, for its fast rebuild better to save
+#   it on performance build hosts
+# - perf_tmp/ubuntu-bionic:perf_<commit_SHA>
+#   images with always changed Tarantool sources and its
+#   depends benchmarks like 'cbench', image need to be
+#   removed after each testing to save the disk space
+# #########################################################
+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 +157,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