Skip to content

Commit 254c4f3

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 2966f4c commit 254c4f3

File tree

7 files changed

+589
-169
lines changed

7 files changed

+589
-169
lines changed

.github/workflows/test_on_push.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,41 @@ 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+
# This server starts and listen on 8084 port that is used for tests
108+
- name: Stop Mono server
109+
run: sudo kill -9 $(sudo lsof -t -i tcp:8084) || true
110+
111+
- run: cmake -S . -B build
112+
113+
- name: Run performance tests
114+
run: make -C build performance
115+
81116
run-tests-ee:
82117
if: github.event_name == 'push'
83118
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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,9 @@ crud.cfg
718718
stats_driver: local
719719
...
720720
```
721+
Performance overhead is 3-10% in case of `local` driver and
722+
5-15% in case of `metrics` driver, up to 20% for `metrics` with quantiles.
723+
721724
Beware that iterating through `crud.cfg` with pairs is not supported yet,
722725
refer to [tarantool/crud#265](https://github.com/tarantool/crud/issues/265).
723726

test/entrypoint/srv_ddl.lua

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

105+
local customers_id_schema = table.deepcopy(customers_schema)
106+
customers_id_schema.sharding_key = {'id'}
107+
table.insert(customers_id_schema.indexes, primary_index_id)
108+
table.insert(customers_id_schema.indexes, bucket_id_index)
109+
table.insert(customers_id_schema.indexes, age_index)
110+
105111
local customers_name_key_schema = table.deepcopy(customers_schema)
106112
customers_name_key_schema.sharding_key = {'name'}
107113
table.insert(customers_name_key_schema.indexes, primary_index)
@@ -157,6 +163,7 @@ package.preload['customers-storage'] = function()
157163

158164
local schema = {
159165
spaces = {
166+
customers = customers_id_schema,
160167
customers_name_key = customers_name_key_schema,
161168
customers_name_key_uniq_index = customers_name_key_uniq_index_schema,
162169
customers_name_key_non_uniq_index = customers_name_key_non_uniq_index_schema,
@@ -195,8 +202,8 @@ local ok, err = errors.pcall('CartridgeCfgError', cartridge.cfg, {
195202
'customers-storage',
196203
'cartridge.roles.crud-router',
197204
'cartridge.roles.crud-storage',
198-
},
199-
})
205+
}}, { readahead = 20 * 1024 * 1024 }
206+
)
200207

201208
if not ok then
202209
log.error('%s', err)

test/integration/ddl_sharding_key_test.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,7 @@ pgroup.test_update_cache_with_incorrect_key = function(g)
696696
-- records for all spaces exist
697697
sharding_key_as_index_obj = helpers.get_sharding_key_cache(g.cluster)
698698
t.assert_equals(sharding_key_as_index_obj, {
699+
customers = {parts = {{fieldno = 1}}},
699700
customers_G_func = {parts = {{fieldno = 1}}},
700701
customers_body_func = {parts = {{fieldno = 1}}},
701702
customers_age_key = {parts = {{fieldno = 4}}},
@@ -722,6 +723,7 @@ pgroup.test_update_cache_with_incorrect_key = function(g)
722723
-- other records for correct spaces exist in cache
723724
sharding_key_as_index_obj = helpers.get_sharding_key_cache(g.cluster)
724725
t.assert_equals(sharding_key_as_index_obj, {
726+
customers = {parts = {{fieldno = 1}}},
725727
customers_G_func = {parts = {{fieldno = 1}}},
726728
customers_body_func = {parts = {{fieldno = 1}}},
727729
customers_age_key = {parts = {{fieldno = 4}}},
@@ -747,6 +749,7 @@ pgroup.test_update_cache_with_incorrect_key = function(g)
747749
-- other records for correct spaces exist in cache
748750
sharding_key_as_index_obj = helpers.get_sharding_key_cache(g.cluster)
749751
t.assert_equals(sharding_key_as_index_obj, {
752+
customers = {parts = {{fieldno = 1}}},
750753
customers_G_func = {parts = {{fieldno = 1}}},
751754
customers_body_func = {parts = {{fieldno = 1}}},
752755
customers_age_key = {parts = {{fieldno = 4}}},

0 commit comments

Comments
 (0)