Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions k6/02-reservation-concurrency.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ const errorRate = new Rate('reservation_error_rate');
const reserveDuration = new Trend('reservation_duration', true);

export const options = {
// stdout 메트릭에 p99 노출 (기본은 p95까지만)
summaryTrendStats: ['avg', 'min', 'med', 'max', 'p(95)', 'p(99)'],
scenarios: {
// 100명이 동시에 한꺼번에 예약 요청 — 스파이크 시나리오
spike: {
Expand Down
2 changes: 2 additions & 0 deletions k6/08-coupon-issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ const issueDuration = new Trend('coupon_issue_duration', true);
const errorRate = new Rate('coupon_error_rate');

export const options = {
// stdout 메트릭에 p99 노출 (기본은 p95까지만 → 결과 출력에서 p99=0 표시 버그 해소)
summaryTrendStats: ['avg', 'min', 'med', 'max', 'p(95)', 'p(99)'],
scenarios: {
// 선착순 스파이크: 5초 만에 50명 동시 요청
spike: {
Expand Down
5 changes: 4 additions & 1 deletion k6/11-vacancy-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,10 @@ const redisClient = (PHASE === 'smembers' || PHASE === 'ttl') ? new redis.Client

export const options = (() => {
if (PHASE === 'subscribe') {
return { vus: N, iterations: N };
// per-vu-iterations: 각 VU가 정확히 1 iter씩 → N개 토큰이 1:1로 사용됨.
// 기존 { vus: N, iterations: N } shared 모드는 빠른 VU가 추가 iter를 가져가
// TOKENS 분배가 불균등해짐 (실측: VU 1~10만 사용되어 SCARD가 10).
return { scenarios: { default: { executor: 'per-vu-iterations', vus: N, iterations: 1 } } };
Comment on lines 185 to +189

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

설정된 VU 수(N)가 제공된 토큰 개수(TOKENS.length)보다 클 경우, 여러 VU가 동일한 토큰을 중복 사용하여 요청을 보내게 됩니다. 이 경우 백엔드에서 VACANCY_ALREADY_REGISTERED 에러가 발생하여 subscribe 2xx 검증(check)이 실패하게 됩니다.

따라서 NTOKENS.length보다 큰 경우 에러를 던져 테스트 실행 전에 설정을 검증하도록 개선하는 것을 제안합니다.

    if (PHASE === 'subscribe') {
        if (N > TOKENS.length) {
            throw new Error('[Config Error] N (' + N + ') cannot be greater than TOKENS count (' + TOKENS.length + ') in subscribe phase.');
        }
        // per-vu-iterations: 각 VU가 정확히 1 iter씩 → N개 토큰이 1:1로 사용됨.
        // 기존 { vus: N, iterations: N } shared 모드는 빠른 VU가 추가 iter를 가져가
        // TOKENS 분배가 불균등해짐 (실측: VU 1~10만 사용되어 SCARD가 10).
        return { scenarios: { default: { executor: 'per-vu-iterations', vus: N, iterations: 1 } } };
    }

}
if (PHASE === 'smembers') {
// 단일 VU 가 N 번 반복 - SMEMBERS 자체 응답시간 분포만 본다.
Expand Down
Loading