Skip to content

Commit f6f1ab2

Browse files
RedisGraph benchmark automation (#1557)
* Added local and remote benchmark definition and automation * [fix] Fixes per PR review. Added option to specify benchmark via BENCHMARH=<benchmark name>. Updated benchmark template Co-authored-by: filipecosta90 <[email protected]>
1 parent 15ae0a7 commit f6f1ab2

File tree

14 files changed

+959
-45
lines changed

14 files changed

+959
-45
lines changed

.circleci/config.yml

Lines changed: 127 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,35 @@ commands:
2222
(mkdir -p deps; cd deps; git clone https://github.com/RedisLabsModules/readies.git)
2323
PIP=1 ./deps/readies/bin/getpy3
2424
python3 -m pip install -r ./deps/readies/paella/requirements.txt
25+
26+
load-cached-deps:
27+
steps:
28+
# Load GraphBLAS from cache if possible.
29+
- restore_cache:
30+
keys:
31+
- GraphBLAS4.0-{{checksum "./deps/GraphBLAS/README.md"}}
2532

26-
jobs:
27-
build:
28-
docker:
29-
- image: 'redisfab/rmbuilder:6.0.9-x64-bionic'
30-
environment:
31-
LANG: en_US.UTF-8
32-
LANGUAGE: en_US.UTF-8
33-
LC_ALL: en_US.UTF-8
33+
# Load libcypher-parser from cache if possible.
34+
- restore_cache:
35+
keys:
36+
- libcypher-parser-{{checksum "./deps/libcypher-parser/README.md"}}
37+
38+
save-deps-cache:
39+
steps:
40+
# Save GraphBLAS to cache.
41+
- save_cache:
42+
paths:
43+
- deps/GraphBLAS
44+
key: GraphBLAS4.0-{{checksum "./deps/GraphBLAS/README.md"}}
45+
46+
# Save libcypher-parser to cache.
47+
- save_cache:
48+
paths:
49+
- deps/libcypher-parser
50+
key: libcypher-parser-{{checksum "./deps/libcypher-parser/README.md"}}
51+
52+
setup-prerequisits:
3453
steps:
35-
- checkout
3654
- run:
3755
name: Fetch submodules
3856
command: |
@@ -59,49 +77,34 @@ jobs:
5977
locale-gen --purge en_US.UTF-8
6078
dpkg-reconfigure -f noninteractive locales
6179
80+
jobs:
81+
build:
82+
docker:
83+
- image: 'redisfab/rmbuilder:6.0.9-x64-bionic'
84+
environment:
85+
LANG: en_US.UTF-8
86+
LANGUAGE: en_US.UTF-8
87+
LC_ALL: en_US.UTF-8
88+
steps:
89+
- checkout
90+
- setup-prerequisits
6291
- setup-automation
63-
64-
# Validate source complies with formatting
65-
#- run:
66-
# name: Formatting
67-
# command: astyle --options=.astylerc -R "./*.c,*.h" --dry-run -Q
68-
69-
# Load GraphBLAS from cache if possible.
70-
- restore_cache:
71-
keys:
72-
- GraphBLAS4.0-{{checksum "./deps/GraphBLAS/README.md"}}
73-
74-
# Load libcypher-parser from cache if possible.
75-
- restore_cache:
76-
keys:
77-
- libcypher-parser-{{checksum "./deps/libcypher-parser/lib/src/parser.leg"}}
92+
- load-cached-deps
7893

7994
- run:
8095
name: Build
8196
command: make
8297

83-
# Save GraphBLAS to cache.
84-
- save_cache:
85-
paths:
86-
- deps/GraphBLAS
87-
key: GraphBLAS4.0-{{checksum "./deps/GraphBLAS/README.md"}}
98+
- save-deps-cache
8899

89-
# Save libcypher-parser to cache.
90-
- save_cache:
91-
paths:
92-
- deps/libcypher-parser
93-
key: libcypher-parser-{{checksum "./deps/libcypher-parser/README.md"}}
94-
95-
- run:
96-
name: Test
97-
command: make test
98100
- early_return_for_forked_pull_requests
99101

100102
- run:
101103
name: Persist Artifacts
102104
command: |
103105
strip src/$MODULE_ARTIFACT
104-
mkdir -p /workspace/build && cp src/$MODULE_ARTIFACT /workspace
106+
mkdir -p /workspace/build
107+
cp src/$MODULE_ARTIFACT /workspace
105108
cp ramp.yml /workspace/
106109
107110
- persist_to_workspace:
@@ -111,12 +114,45 @@ jobs:
111114
- ramp.yml
112115
- build
113116

117+
build_test:
118+
docker:
119+
- image: 'redisfab/rmbuilder:6.0.9-x64-bionic'
120+
environment:
121+
LANG: en_US.UTF-8
122+
LANGUAGE: en_US.UTF-8
123+
LC_ALL: en_US.UTF-8
124+
steps:
125+
- checkout
126+
- setup-prerequisits
127+
- setup-automation
128+
- attach_workspace:
129+
at: /workspace
130+
- load-cached-deps
131+
132+
- run:
133+
name: Test
134+
command: make test
135+
136+
build_memcheck:
137+
docker:
138+
- image: 'redisfab/rmbuilder:6.0.9-x64-bionic'
139+
environment:
140+
LANG: en_US.UTF-8
141+
LANGUAGE: en_US.UTF-8
142+
LC_ALL: en_US.UTF-8
143+
steps:
144+
- checkout
145+
- setup-prerequisits
146+
- setup-automation
147+
- load-cached-deps
148+
- attach_workspace:
149+
at: /workspace
150+
114151
- run:
115152
name: Test for memory leaks
116153
command: |
117154
# Replace the default Redis server with one linked to libc malloc rather than jemalloc.
118155
python ./deps/readies/bin/getredis --force --valgrind
119-
make clean
120156
make memcheck # Re-run the test suite, failing if definite memory leaks have been introduced.
121157
# Allow RediSearch global destructors.
122158
environment:
@@ -208,6 +244,41 @@ jobs:
208244
name: Run QA Automation
209245
command: MODULE_VERSION=$CIRCLE_BRANCH VERBOSE=1 TEST=nightly QUICK=1 ./tests/qa/run
210246

247+
performance_ci_automation:
248+
docker:
249+
- image: 'redisfab/rmbuilder:6.0.9-x64-bionic'
250+
steps:
251+
- checkout
252+
- attach_workspace:
253+
at: /workspace
254+
- run:
255+
name: Install remote benchmark tool dependencies
256+
command: TF_EXE_FILE_NAME=/workspace/terraform ./tests/benchmarks/remote/install_deps.sh
257+
- run:
258+
name: Install remote benchmark python dependencies
259+
command: python3 -m pip install -r ./tests/benchmarks/requirements.txt
260+
- run:
261+
name: Run CI benchmarks on aws
262+
command: |
263+
cd ./tests/benchmarks
264+
export AWS_ACCESS_KEY_ID=$PERFORMANCE_EC2_ACCESS_KEY
265+
export AWS_SECRET_ACCESS_KEY=$PERFORMANCE_EC2_SECRET_KEY
266+
export AWS_DEFAULT_REGION=$PERFORMANCE_EC2_REGION
267+
export EC2_PRIVATE_PEM=$PERFORMANCE_EC2_PRIVATE_PEM
268+
269+
python3 remote-runner.py \
270+
--terraform_bin_path /workspace/terraform \
271+
--module_path /workspace/$MODULE_ARTIFACT \
272+
--github_actor $CIRCLE_USERNAME \
273+
--github_repo $CIRCLE_PROJECT_REPONAME \
274+
--github_org $CIRCLE_PROJECT_USERNAME \
275+
--github_sha $CIRCLE_SHA1 \
276+
--github_branch $CIRCLE_BRANCH \
277+
--upload_results_s3 \
278+
--triggering_env circleci \
279+
--push_results_redistimeseries
280+
281+
211282
212283
on-any-branch: &on-any-branch
213284
filters:
@@ -250,14 +321,24 @@ workflows:
250321
jobs:
251322
- build:
252323
<<: *on-any-branch
324+
- build_test:
325+
<<: *on-any-branch
326+
requires:
327+
- build
328+
- build_memcheck:
329+
<<: *on-any-branch
330+
requires:
331+
- build
253332
- package_branch:
254333
<<: *on-master
255334
requires:
256-
- build
335+
- build_test
336+
- build_memcheck
257337
- package_release:
258338
<<: *on-version-tags
259339
requires:
260-
- build
340+
- build_test
341+
- build_memcheck
261342
- deploy_branch:
262343
requires:
263344
- package_branch
@@ -268,6 +349,10 @@ workflows:
268349
<<: *on-version-tags
269350
requires:
270351
- package_release
352+
- performance_ci_automation:
353+
<<: *on-any-branch
354+
requires:
355+
- build_test
271356

272357
nightly:
273358
triggers:

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,7 @@ deps/GraphBLAS/Config/GraphBLAS.h.tmp
5252
*.make
5353
*.xml
5454
*.iml
55-
*.d
55+
*.d
56+
57+
# local/remote benchmark result files
58+
tests/benchmarks/*.json

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: all clean package docker docker_push docker_alpine builddocs localdocs deploydocs test test_valgrind
1+
.PHONY: all clean package docker docker_push docker_alpine builddocs localdocs deploydocs test benchmark test_valgrind
22

33
all:
44
@$(MAKE) -C ./src all
@@ -36,6 +36,9 @@ deploydocs: builddocs
3636
test:
3737
@$(MAKE) -C ./src test
3838

39+
benchmark:
40+
@$(MAKE) -C ./src benchmark
41+
3942
memcheck:
4043
@$(MAKE) -C ./src memcheck
4144

src/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,7 @@ memcheck: CFLAGS += -fno-omit-frame-pointer -g -ggdb -O0 -D MEMCHECK
207207
memcheck: SHOBJ_LDFLAGS += -u RediSearch_CleanupModule
208208
memcheck: redisgraph.so
209209
@$(MAKE) -C ../tests memcheck
210+
211+
212+
benchmark: redisgraph.so
213+
@$(MAKE) -C ../tests benchmark

tests/Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
MAKEFLAGS += --no-builtin-rules
33

4-
.PHONY: test unit flow tck memcheck clean
4+
.PHONY: test unit flow tck memcheck benchmark clean
55

66
TEST_ARGS+=--clear-logs
77

@@ -10,6 +10,10 @@ ifneq ($(V),)
1010
TEST_ARGS += --verbose
1111
endif
1212

13+
ifneq ($(BENCHMARK),)
14+
BENCHMARK_ARGS += --test $(BENCHMARK)
15+
endif
16+
1317
# check environment flag
1418
ifneq ($(ENV),)
1519
TEST_ARGS += --env $(ENV)
@@ -43,6 +47,9 @@ memcheck:
4347
@$(MAKE) -C tck TEST_ARGS="$(MEMCHECK_ARGS)"
4448
./memcheck.sh
4549

50+
benchmark:
51+
cd benchmarks; python3 local-runner.py $(BENCHMARK_ARGS) ; cd ..
52+
4653
clean:
4754
@find . -name '*.[oad]' -type f -delete
4855
@find . -name '*.run' -type f -delete

0 commit comments

Comments
 (0)