Skip to content

Commit a7e0969

Browse files
tests: separate performance tests
Before this patch, performance tests ran together with unit and integration with `--coverage` flag. Coverage analysis cropped the result of performance tests to 10-15 times. For metrics integration it resulted in timeout errors and drop of performance which is not reproduces with coverage disabled. Moreover, before this patch log capture was disabled and performance tests did not displayed any results after run. Now performance tests also run is separate CI job. After this patch, `make -C build coverage` will run lightweight version of performance test. `make -C build performance` will run real performance tests. You can paste output table to GitHub [1]. This path also reworks current performance test. It adds new cases to compare module performance with or without statistics, statistic wrappers and compare different metrics drivers and reports new info: average call time and max call time. Performance test result: overhead is 3-10% in case of `local` driver and 5-15% in case of `metrics` driver, up to 20% for `metrics` with quantiles. Based on several runs on HP ProBook 440 G7 i7/16Gb/256SSD. 1. https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables Closes #233, follows up #224
1 parent e6f6877 commit a7e0969

File tree

6 files changed

+592
-169
lines changed

6 files changed

+592
-169
lines changed

.github/workflows/test_on_push.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,48 @@ jobs:
7878
run: make -C build coveralls
7979
if: ${{ matrix.coveralls }}
8080

81+
run-perf-tests-ce:
82+
if: |
83+
github.event_name == 'push' ||
84+
github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
85+
strategy:
86+
matrix:
87+
tarantool-version: ["1.10", "2.8"]
88+
metrics-version: ["0.12.0"]
89+
fail-fast: false
90+
runs-on: [ubuntu-latest]
91+
steps:
92+
- uses: actions/checkout@master
93+
94+
- name: Setup Tarantool CE
95+
uses: tarantool/setup-tarantool@v1
96+
with:
97+
tarantool-version: ${{ matrix.tarantool-version }}
98+
99+
- name: Install requirements for community
100+
run: |
101+
tarantool --version
102+
./deps.sh
103+
104+
- name: Install metrics
105+
run: tarantoolctl rocks install metrics ${{ matrix.metrics-version }}
106+
107+
- name: Remove external merger if needed
108+
if: ${{ matrix.remove-merger }}
109+
run: rm .rocks/lib/tarantool/tuple/merger.so
110+
111+
# This server starts and listen on 8084 port that is used for tests
112+
- name: Stop Mono server
113+
run: sudo kill -9 $(sudo lsof -t -i tcp:8084) || true
114+
115+
- run: cmake -S . -B build
116+
env:
117+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
118+
119+
- name: Run performance tests
120+
run: make -C build performance
121+
if: ${{ matrix.perf-test }}
122+
81123
run-tests-ee:
82124
if: github.event_name == 'push'
83125
strategy:

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ add_custom_target(luatest
3636
COMMENT "Run regression tests"
3737
)
3838

39+
set(PERFORMANCE_TESTS_SUBDIR "test/performance")
40+
41+
add_custom_target(performance
42+
COMMAND PERF_MODE_ON=true ${LUATEST} -v -c ${PERFORMANCE_TESTS_SUBDIR}
43+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
44+
COMMENT "Run performance tests"
45+
)
46+
3947
add_custom_target(coverage
4048
COMMAND ${LUACOV} ${PROJECT_SOURCE_DIR} && grep -A999 '^Summary' ${CODE_COVERAGE_REPORT}
4149
DEPENDS ${CODE_COVERAGE_STATS}

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,8 @@ crud.cfg
645645
stats_driver: local
646646
...
647647
```
648+
Performance overhead is 3-10% in case of `local` driver and
649+
5-15% in case of `metrics` driver, up to 20% for `metrics` with quantiles.
648650

649651
Format is as follows.
650652
```lua

test/entrypoint/srv_ddl.lua

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ package.preload['customers-storage'] = function()
9090
},
9191
}
9292

93+
local customers_id_schema = table.deepcopy(customers_schema)
94+
customers_id_schema.sharding_key = {'id'}
95+
table.insert(customers_id_schema.indexes, primary_index_id)
96+
table.insert(customers_id_schema.indexes, bucket_id_index)
97+
table.insert(customers_id_schema.indexes, age_index)
98+
9399
local customers_name_key_schema = table.deepcopy(customers_schema)
94100
customers_name_key_schema.sharding_key = {'name'}
95101
table.insert(customers_name_key_schema.indexes, primary_index)
@@ -133,6 +139,7 @@ package.preload['customers-storage'] = function()
133139

134140
local schema = {
135141
spaces = {
142+
customers = customers_id_schema,
136143
customers_name_key = customers_name_key_schema,
137144
customers_name_key_uniq_index = customers_name_key_uniq_index_schema,
138145
customers_name_key_non_uniq_index = customers_name_key_non_uniq_index_schema,
@@ -166,8 +173,8 @@ local ok, err = errors.pcall('CartridgeCfgError', cartridge.cfg, {
166173
'customers-storage',
167174
'cartridge.roles.crud-router',
168175
'cartridge.roles.crud-storage',
169-
},
170-
})
176+
}}, { readahead = 20 * 1024 * 1024 }
177+
)
171178

172179
if not ok then
173180
log.error('%s', err)

0 commit comments

Comments
 (0)