Skip to content

Commit c89292c

Browse files
committed
discard overflow sliding window
discard overflow sliding window 119a0330b912b4023932f3612b25cb36c8792fed
1 parent 1f3931d commit c89292c

21 files changed

Lines changed: 40 additions & 86 deletions

.changes/v0.5.28.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## v0.5.28 - 2024-06-24
2+
### Changed
3+
* `discard_overflow` logic. Waiter wait 2 seconds sliding window before skip payload

.github/workflows/test.yml

Lines changed: 14 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,6 @@ on:
1010
- master
1111
- dev
1212

13-
env:
14-
YC_LT_FOLDER_ID: b1gacohsvc2kc4d76tu5
15-
YC_LT_AUTHORIZED_KEY_JSON: ${{ secrets.YC_LOADTESTING_CI_AUTHORIZED_KEY_JSON }}
16-
YC_LT_TEST_AGENT_FILTER: "name = 'agent-pandora-perf-medium'"
17-
YC_LT_TEST_EXTRA_DESCRIPTION: "GitHub Actions workflow - ${{github.run_id}}"
18-
YC_LT_SKIP_TEST_CHECK: "1"
19-
YC_LT_DATA_BUCKET: ${{ secrets.YC_LT_DATA_BUCKET }}
20-
YC_LT_OUTPUT_DIR: ${{github.workspace}}/performance-test/output
21-
2213
jobs:
2314
run-unit-tests:
2415
name: Unit Tests
@@ -28,7 +19,7 @@ jobs:
2819
strategy:
2920
fail-fast: false
3021
matrix:
31-
os: [ubuntu]
22+
os: [ubuntu, macOS]
3223
env:
3324
OS: ${{ matrix.os }}-latest
3425
GO: ${{ matrix.go-version }}
@@ -37,64 +28,18 @@ jobs:
3728
- name: Checkout code
3829
uses: actions/checkout@v3
3930

40-
- name: Parse to Release
41-
env:
42-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43-
RELEASE_ID: 161082234
44-
run: |
45-
cat <<EOF > imbalance.txt
46-
## Performance tests
47-
- pandora-perf-grpc-300inst-sleep0ms: 12344
48-
- pandora-perf-grpc-3000inst-sleep0ms: 15555
49-
EOF
50-
51-
sed G imbalance.txt > imbalance.md
52-
53-
- name: Update release
54-
id: update_release
55-
uses: tubone24/update_release@v1.0
56-
env:
57-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58-
TAG_NAME: v0.5.27.alpha13
31+
- name: Install Go
32+
uses: actions/setup-go@v3
5933
with:
60-
body_path: ./imbalance.md
61-
is_append_body: true
34+
go-version: 1.21.x
35+
cache: true
6236

63-
# build-and-upload:
64-
# runs-on: ubuntu-latest
65-
# steps:
66-
# - uses: actions/checkout@v4
67-
# - uses: ./.github/actions/setup-yc
68-
# - name: Install Go
69-
# uses: actions/setup-go@v3
70-
# with:
71-
# go-version: 1.21.x
72-
# cache: true
73-
# - name: Test
74-
# run: go test -race -covermode atomic ./...
75-
# - name: Build
76-
# run: |
77-
# export GOOS=linux
78-
# export CGO_ENABLED=0
79-
# go build -o pandora_perf_2
80-
# - name: Upload
81-
# run: |
82-
# source performance-test/automation/_functions.sh && source performance-test/automation/_variables.sh; yc_s3_upload ./pandora_perf_2 pandora-perf ${YC_LT_DATA_BUCKET}
83-
#
84-
# test-pandora-perf:
85-
# needs: [ build-and-upload ]
86-
# runs-on: ubuntu-latest
87-
# concurrency: { group: loadtesting }
88-
# steps:
89-
# - uses: actions/checkout@v4
90-
# - uses: ./.github/actions/setup-yc
91-
# - name: Run Test HTTP-300inst-sleep0ms
92-
# run: |
93-
# stripped_tag="${{ github.event.release.tag_name }}"
94-
# STRIPPED_TAG=${stripped_tag:1}
95-
# YC_LT_VERBOSE=2 YC_LT_TEST_EXTRA_LABELS="version=${STRIPPED_TAG}" ./performance-test/automation/test.sh ./performance-test/test-config/pandora-perf-http-uri-300inst-sleep0ms
96-
# - name: Upload Artifacts GRPC 300inst-sleep0ms
97-
# uses: actions/upload-artifact@v4
98-
# with:
99-
# name: pandora-perf-grpc-300inst-sleep0ms
100-
# path: ${{ env.YC_LT_OUTPUT_DIR }}
37+
- name: Test
38+
run: go test -race -coverprofile unit.txt -covermode atomic ./...
39+
40+
- name: Upload coverage report to Codecov
41+
uses: codecov/codecov-action@v3
42+
with:
43+
file: ./unit.txt
44+
flags: unit,${{ matrix.os }},go-${{ matrix.go-version }}
45+
name: unit

.mapping.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
".changes/v0.5.25.md":"load/projects/pandora/.changes/v0.5.25.md",
2626
".changes/v0.5.26.md":"load/projects/pandora/.changes/v0.5.26.md",
2727
".changes/v0.5.27.md":"load/projects/pandora/.changes/v0.5.27.md",
28+
".changes/v0.5.28.md":"load/projects/pandora/.changes/v0.5.28.md",
2829
".changie.yaml":"load/projects/pandora/.changie.yaml",
2930
".github/actions/setup-yc/action.yml":"load/projects/pandora/.github/actions/setup-yc/action.yml",
3031
".github/workflows/release.yml":"load/projects/pandora/.github/workflows/release.yml",
@@ -293,7 +294,6 @@
293294
"docs/index.md":"load/projects/pandora/docs/index.md",
294295
"docs/rus/architecture.md":"load/projects/pandora/docs/rus/architecture.md",
295296
"docs/rus/best-practices.md":"load/projects/pandora/docs/rus/best-practices.md",
296-
"docs/rus/best_practices.md":"load/projects/pandora/docs/rus/best_practices.md",
297297
"docs/rus/best_practices/discard-overflow.md":"load/projects/pandora/docs/rus/best_practices/discard-overflow.md",
298298
"docs/rus/best_practices/rps-per-instance.md":"load/projects/pandora/docs/rus/best_practices/rps-per-instance.md",
299299
"docs/rus/best_practices/shared-client.md":"load/projects/pandora/docs/rus/best_practices/shared-client.md",

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
66
and is generated by [Changie](https://github.com/miniscruff/changie).
77

88

9+
## v0.5.28 - 2024-06-24
10+
### Changed
11+
* `discard_overflow` logic. Waiter wait 2 seconds sliding window before skip payload
12+
913
## v0.5.27 - 2024-06-18
1014
### Added
1115
* Performance test on release

cli/cli.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"go.uber.org/zap/zapcore"
2626
)
2727

28-
const Version = "0.5.27"
28+
const Version = "0.5.28"
2929
const defaultConfigFile = "load"
3030
const stdinConfigSelector = "-"
3131

core/coreutil/waiter.go

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ import (
77
"github.com/yandex/pandora/core"
88
)
99

10+
const MaxOverdueDuration = 2 * time.Second
11+
1012
// Waiter goroutine unsafe wrapper for efficient waiting schedule.
1113
type Waiter struct {
12-
sched core.Schedule
13-
slowDownItems int
14+
sched core.Schedule
15+
overdueDuration time.Duration
1416

1517
// Lazy initialized.
1618
timer *time.Timer
@@ -28,28 +30,29 @@ func (w *Waiter) Wait(ctx context.Context) (ok bool) {
2830
// Check, that context is not done. Very quick: 5 ns for op, due to benchmark.
2931
select {
3032
case <-ctx.Done():
31-
w.slowDownItems = 0
33+
w.overdueDuration = 0
3234
return false
3335
default:
3436
}
3537
next, ok := w.sched.Next()
3638
if !ok {
37-
w.slowDownItems = 0
39+
w.overdueDuration = 0
3840
return false
3941
}
4042
// Get current time lazily.
4143
// For once schedule, for example, we need to get it only once.
42-
if next.Before(w.lastNow) {
43-
w.slowDownItems++
44+
waitFor := next.Sub(w.lastNow)
45+
if waitFor <= 0 {
46+
w.overdueDuration = 0 - waitFor
4447
return true
4548
}
4649
w.lastNow = time.Now()
47-
waitFor := next.Sub(w.lastNow)
50+
waitFor = next.Sub(w.lastNow)
4851
if waitFor <= 0 {
49-
w.slowDownItems++
52+
w.overdueDuration = 0 - waitFor
5053
return true
5154
}
52-
w.slowDownItems = 0
55+
w.overdueDuration = 0
5356
// Lazy init. We don't need timer for unlimited and once schedule.
5457
if w.timer == nil {
5558
w.timer = time.NewTimer(waitFor)
@@ -70,7 +73,7 @@ func (w *Waiter) IsSlowDown(ctx context.Context) (ok bool) {
7073
case <-ctx.Done():
7174
return false
7275
default:
73-
return w.slowDownItems >= 2
76+
return w.overdueDuration >= MaxOverdueDuration
7477
}
7578
}
7679

docs/eng/best_practices/discard-overflow.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ The instance setting `discard_overflow` determines which behavior to follow.
2323
instances.
2424
2. `discard_overflow: true` - Strict adherence to the request schedule by the generator. Requests that do not fit into
2525
the schedule are discarded. The test duration is predetermined. Requests that fail to meet the schedule are marked as
26-
failed (with a net error `777`, and also tagged as discarded).
26+
failed (with a net error `777`, and also tagged as discarded). Pandora considers a test to have failed schedule, if
27+
the time of the request is 2 seconds behind. That is 2 second sliding window is used.
2728

2829
By default, starting from version pandora@0.5.24, the setting `discard_overflow: true` is enabled.
2930

docs/rus/best_practices.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/rus/best_practices/discard-overflow.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
и количества инстансов.
2323
2. `discard_overflow: true` - строгое следование генератором расписания запросов. Запросы, не уложившиеся
2424
в расписание, отбрасываются. Время выполнения теста предопределено. Запросы, которые не укладываются в расписание,
25-
помечаются неудавшимися (ошибка net `777`, а так же добавляется tag:discarded).
25+
помечаются неудавшимися (ошибка net `777`, а так же добавляется tag:discarded). Пандора считает, что тест не уложился
26+
в расписание, если время запроса отстало на 2 сек. То есть используется 2 секундное скользящее окно.
2627

2728
По-умолчанию, начиная с версии pandora@0.5.24 настройка `discard_overflow: true`
2829

performance-test/automation/_agent_create.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)