From bb36eab63e7013e029910afd5e13e45b2fd739df Mon Sep 17 00:00:00 2001 From: Jeff Mendoza Date: Tue, 12 Dec 2023 11:43:36 -0800 Subject: [PATCH] Add benchmark for TiKV (#1579) Also add make target to start up GUAC with TiKV and necessary compose files. Signed-off-by: Jeff Mendoza --- .github/workflows/db-performance-test.yaml | 11 ++++ Makefile | 13 +++++ container_files/tikv.yaml | 59 ++++++++++++++++++++++ container_files/tikv/guac.yaml | 24 +++++++++ 4 files changed, 107 insertions(+) create mode 100644 container_files/tikv.yaml create mode 100644 container_files/tikv/guac.yaml diff --git a/.github/workflows/db-performance-test.yaml b/.github/workflows/db-performance-test.yaml index 2ac70bb74f..0cff21c06a 100644 --- a/.github/workflows/db-performance-test.yaml +++ b/.github/workflows/db-performance-test.yaml @@ -41,6 +41,7 @@ jobs: database: - inmem - redis + - tikv - arango - ent outputs: @@ -84,6 +85,8 @@ jobs: make start-inmem-db elif [ ${{ matrix.database }} == redis ]; then make start-redis-db + elif [ ${{ matrix.database }} == tikv ]; then + make start-tikv-db elif [ ${{ matrix.database }} == "arango" ]; then make start-arango-db elif [ ${{ matrix.database }} == "ent" ]; then @@ -166,14 +169,22 @@ jobs: printf "%-15s%-20s%s\n" "----" "--------------" "----" printf "%-15s%-20s%s seconds\n" "Ingestion" "inmem" "${{ env.inmem }}" printf "%-15s%-20s%s seconds\n" "Ingestion" "arango" "${{ env.arango }}" + printf "%-15s%-20s%s seconds\n" "Ingestion" "redis" "${{ env.redis }}" + printf "%-15s%-20s%s seconds\n" "Ingestion" "tikv" "${{ env.tikv }}" printf "%-15s%-20s%s seconds\n" "Ingestion" "ent" "${{ env.ent }}" printf "%-15s%-20s%s seconds\n" "Query" "inmem" "${{ env.inmem_query }}" printf "%-15s%-20s%s seconds\n" "Query" "arango" "${{ env.arango_query }}" + printf "%-15s%-20s%s seconds\n" "Query" "redis" "${{ env.redis_query }}" + printf "%-15s%-20s%s seconds\n" "Query" "tikv" "${{ env.tikv_query }}" printf "%-15s%-20s%s seconds\n" "Query" "ent" "${{ env.ent_query }}" env: inmem: ${{ fromJson(needs.read.outputs.result).elapsed_time.inmem }} arango: ${{ fromJson(needs.read.outputs.result).elapsed_time.arango }} + redis: ${{ fromJson(needs.read.outputs.result).elapsed_time.redis }} + tikv: ${{ fromJson(needs.read.outputs.result).elapsed_time.tikv }} ent: ${{ fromJson(needs.read.outputs.result).elapsed_time.ent }} inmem_query: ${{ fromJson(needs.read.outputs.query_result).query_time.inmem }} arango_query: ${{ fromJson(needs.read.outputs.query_result).query_time.arango }} + redis_query: ${{ fromJson(needs.read.outputs.query_result).query_time.redis }} + tikv_query: ${{ fromJson(needs.read.outputs.query_result).query_time.tikv }} ent_query: ${{ fromJson(needs.read.outputs.query_result).query_time.ent }} diff --git a/Makefile b/Makefile index b5722a106c..e10cb1dade 100644 --- a/Makefile +++ b/Makefile @@ -187,6 +187,19 @@ start-redis-db: check-docker-compose-tool-check done; \ [ $$counter -eq 15 ] && { echo "Redis GUAC service did not start in time"; exit 1; } || echo "Redis GUAC service is up!" +# start graphQL server with keyvalue-tikv backend +.PHONY: start-tikv-db +start-tikv-db: check-docker-compose-tool-check + $(CONTAINER) compose -f docker-compose.yml -f container_files/tikv.yaml up -d 2>&1 + @echo "Waiting for the service to start" + @counter=0; \ + while [ $$counter -lt 15 ] && ! curl --silent --head --output /dev/null --fail http://localhost:8080; do \ + printf '.'; \ + sleep 1; \ + counter=$$((counter+1)); \ + done; \ + [ $$counter -eq 15 ] && { echo "Tikv GUAC service did not start in time"; exit 1; } || echo "Tikv GUAC service is up!" + # start graphQL server with arango backend .PHONY: start-arango-db start-arango-db: check-docker-compose-tool-check diff --git a/container_files/tikv.yaml b/container_files/tikv.yaml new file mode 100644 index 0000000000..8adb3e5863 --- /dev/null +++ b/container_files/tikv.yaml @@ -0,0 +1,59 @@ +version: "3.9" + +volumes: + pd_guac_data: + tikv_guac_data: +services: + guac-graphql: + networks: [frontend] + image: $GUAC_IMAGE + command: "/opt/guac/guacgql" + working_dir: /guac + restart: on-failure + depends_on: + nats: + condition: service_healthy + pd: + condition: service_started + ports: + - "$GUAC_API_PORT:8080" + volumes: + - ./container_files/tikv:/guac:z + healthcheck: + test: ["CMD", "wget", "--spider", "http://localhost:8080"] + interval: 10s + timeout: 10s + retries: 3 + start_period: 5s + pd: + networks: [frontend] + image: docker.io/pingcap/pd:latest + ports: + - "2379" + - "2380" + volumes: + - pd_guac_data:/data + command: + - --name=pd + - --client-urls=http://0.0.0.0:2379 + - --peer-urls=http://0.0.0.0:2380 + - --advertise-client-urls=http://pd:2379 + - --advertise-peer-urls=http://pd:2380 + - --initial-cluster=pd=http://pd:2380 + - --data-dir=/data + restart: on-failure + tikv: + networks: [frontend] + image: docker.io/pingcap/tikv:latest + ports: + - "20160" + volumes: + - tikv_guac_data:/data + command: + - --addr=0.0.0.0:20160 + - --advertise-addr=tikv:20160 + - --data-dir=/data + - --pd=pd:2379 + depends_on: + - "pd" + restart: on-failure diff --git a/container_files/tikv/guac.yaml b/container_files/tikv/guac.yaml new file mode 100644 index 0000000000..fd1ec2e1ce --- /dev/null +++ b/container_files/tikv/guac.yaml @@ -0,0 +1,24 @@ +# nats +nats-addr: nats://nats:4222 + +# collect-sub +csub-addr: guac-collectsub:2782 +csub-listen-port: 2782 + +# graphql +gql-backend: keyvalue +gql-listen-port: 8080 +gql-debug: true +gql-addr: http://guac-graphql:8080/query + +# keyvalue +kv-store: tikv +kv-tikv: pd:2379 + +# collector polling +service-poll: true +use-csub: true + +# certifier polling +poll: true +interval: 5m