Skip to content

Commit

Permalink
tests: separate performance tests
Browse files Browse the repository at this point in the history
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
  • Loading branch information
DifferentialOrange committed Feb 24, 2022
1 parent ec086b4 commit 6b25dba
Show file tree
Hide file tree
Showing 7 changed files with 589 additions and 169 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/test_on_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,41 @@ jobs:
run: make -C build coveralls
if: ${{ matrix.coveralls }}

run-perf-tests-ce:
if: |
github.event_name == 'push' ||
github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
strategy:
matrix:
tarantool-version: ["1.10", "2.8"]
metrics-version: ["0.12.0"]
fail-fast: false
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@master

- name: Setup Tarantool CE
uses: tarantool/setup-tarantool@v1
with:
tarantool-version: ${{ matrix.tarantool-version }}

- name: Install requirements for community
run: |
tarantool --version
./deps.sh
- name: Install metrics
run: tarantoolctl rocks install metrics ${{ matrix.metrics-version }}

# This server starts and listen on 8084 port that is used for tests
- name: Stop Mono server
run: sudo kill -9 $(sudo lsof -t -i tcp:8084) || true

- run: cmake -S . -B build

- name: Run performance tests
run: make -C build performance

run-tests-ee:
if: github.event_name == 'push'
strategy:
Expand Down
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ add_custom_target(luatest
COMMENT "Run regression tests"
)

set(PERFORMANCE_TESTS_SUBDIR "test/performance")

add_custom_target(performance
COMMAND PERF_MODE_ON=true ${LUATEST} -v -c ${PERFORMANCE_TESTS_SUBDIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Run performance tests"
)

add_custom_target(coverage
COMMAND ${LUACOV} ${PROJECT_SOURCE_DIR} && grep -A999 '^Summary' ${CODE_COVERAGE_REPORT}
DEPENDS ${CODE_COVERAGE_STATS}
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,9 @@ crud.cfg
stats_driver: local
...
```
Performance overhead is 3-10% in case of `local` driver and
5-15% in case of `metrics` driver, up to 20% for `metrics` with quantiles.

Beware that iterating through `crud.cfg` with pairs is not supported yet,
refer to [tarantool/crud#265](https://github.com/tarantool/crud/issues/265).

Expand Down
11 changes: 9 additions & 2 deletions test/entrypoint/srv_ddl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ package.preload['customers-storage'] = function()
},
}

local customers_id_schema = table.deepcopy(customers_schema)
customers_id_schema.sharding_key = {'id'}
table.insert(customers_id_schema.indexes, primary_index_id)
table.insert(customers_id_schema.indexes, bucket_id_index)
table.insert(customers_id_schema.indexes, age_index)

local customers_name_key_schema = table.deepcopy(customers_schema)
customers_name_key_schema.sharding_key = {'name'}
table.insert(customers_name_key_schema.indexes, primary_index)
Expand Down Expand Up @@ -157,6 +163,7 @@ package.preload['customers-storage'] = function()

local schema = {
spaces = {
customers = customers_id_schema,
customers_name_key = customers_name_key_schema,
customers_name_key_uniq_index = customers_name_key_uniq_index_schema,
customers_name_key_non_uniq_index = customers_name_key_non_uniq_index_schema,
Expand Down Expand Up @@ -195,8 +202,8 @@ local ok, err = errors.pcall('CartridgeCfgError', cartridge.cfg, {
'customers-storage',
'cartridge.roles.crud-router',
'cartridge.roles.crud-storage',
},
})
}}, { readahead = 20 * 1024 * 1024 }
)

if not ok then
log.error('%s', err)
Expand Down
3 changes: 3 additions & 0 deletions test/integration/ddl_sharding_key_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,7 @@ pgroup.test_update_cache_with_incorrect_key = function(g)
-- records for all spaces exist
sharding_key_as_index_obj = helpers.get_sharding_key_cache(g.cluster)
t.assert_equals(sharding_key_as_index_obj, {
customers = {parts = {{fieldno = 1}}},
customers_G_func = {parts = {{fieldno = 1}}},
customers_body_func = {parts = {{fieldno = 1}}},
customers_age_key = {parts = {{fieldno = 4}}},
Expand All @@ -722,6 +723,7 @@ pgroup.test_update_cache_with_incorrect_key = function(g)
-- other records for correct spaces exist in cache
sharding_key_as_index_obj = helpers.get_sharding_key_cache(g.cluster)
t.assert_equals(sharding_key_as_index_obj, {
customers = {parts = {{fieldno = 1}}},
customers_G_func = {parts = {{fieldno = 1}}},
customers_body_func = {parts = {{fieldno = 1}}},
customers_age_key = {parts = {{fieldno = 4}}},
Expand All @@ -747,6 +749,7 @@ pgroup.test_update_cache_with_incorrect_key = function(g)
-- other records for correct spaces exist in cache
sharding_key_as_index_obj = helpers.get_sharding_key_cache(g.cluster)
t.assert_equals(sharding_key_as_index_obj, {
customers = {parts = {{fieldno = 1}}},
customers_G_func = {parts = {{fieldno = 1}}},
customers_body_func = {parts = {{fieldno = 1}}},
customers_age_key = {parts = {{fieldno = 4}}},
Expand Down
Loading

0 comments on commit 6b25dba

Please sign in to comment.