Skip to content

Commit 91db274

Browse files
Run performance test for metrics
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. After this patch, `make -C build coverage` will run lightweight version of performance test. `make -C build performance` will run real performance tests. 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. Closes #233, follows up #224
1 parent 6f9d79e commit 91db274

File tree

6 files changed

+425
-167
lines changed

6 files changed

+425
-167
lines changed

.github/workflows/test_on_push.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ jobs:
1616
tarantool-version: ["1.10.6", "1.10", "2.2", "2.3", "2.4", "2.5", "2.6", "2.7", "2.8"]
1717
metrics-version: [""]
1818
remove-merger: [false]
19+
perf-test: [false]
1920
include:
21+
- tarantool-version: "1.10"
22+
metrics-version: "0.12.0"
23+
perf-test: true
2024
- tarantool-version: "2.7"
2125
remove-merger: true
2226
- tarantool-version: "2.8"
@@ -26,6 +30,7 @@ jobs:
2630
- tarantool-version: "2.8"
2731
coveralls: true
2832
metrics-version: "0.12.0"
33+
perf-test: true
2934
fail-fast: false
3035
runs-on: [ubuntu-latest]
3136
steps:
@@ -72,6 +77,10 @@ jobs:
7277
- name: Run tests and code coverage analysis
7378
run: make -C build coverage
7479

80+
- name: Run performance tests
81+
run: make -C build performance
82+
if: ${{ matrix.perf-test }}
83+
7584
- name: Send code coverage to coveralls.io
7685
run: make -C build coveralls
7786
if: ${{ matrix.coveralls }}

CMakeLists.txt

+8
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

+2
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,8 @@ crud.enable_stats({ driver = 'metrics' })
616616
-- Use simple local collectors.
617617
crud.enable_stats({ driver = 'local' })
618618
```
619+
Performance overhead is 3-5% in case of `local` driver and
620+
10-20% in case of `metrics` driver.
619621

620622
Format is as follows.
621623
```

crud/stats/metrics_registry.lua

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ local metric_name = {
2828

2929
local LATENCY_QUANTILE = 0.99
3030

31+
-- Increasing tolerance threshold affects performance.
3132
local DEFAULT_QUANTILES = {
3233
[LATENCY_QUANTILE] = 1e-3,
3334
}

0 commit comments

Comments
 (0)