Conversation
There was a problem hiding this comment.
Code Review
This pull request configures k6 options to expose the p99 metric in stdout trend statistics for reservation concurrency and coupon issue tests. It also updates the vacancy test's subscribe phase to use the per-vu-iterations executor, ensuring even token distribution among VUs. The reviewer suggested adding a configuration check to ensure the number of VUs (N) does not exceed the available tokens (TOKENS.length) to prevent duplicate token usage and test failures.
| 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 } } }; |
There was a problem hiding this comment.
설정된 VU 수(N)가 제공된 토큰 개수(TOKENS.length)보다 클 경우, 여러 VU가 동일한 토큰을 중복 사용하여 요청을 보내게 됩니다. 이 경우 백엔드에서 VACANCY_ALREADY_REGISTERED 에러가 발생하여 subscribe 2xx 검증(check)이 실패하게 됩니다.
따라서 N이 TOKENS.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 } } };
}
📢 기능 설명
필요시 실행결과 스크린샷 첨부
연결된 issue
연결된 issue를 자동을 닫기 위해 아래 {이슈넘버}를 입력해주세요.
close #{이슈넘버}
✅ 체크리스트