Skip to content

Commit 64dfbfd

Browse files
✨ feat: 부하테스트 k6 sleep 함수 문제 (#80)
1 parent 7bc39a0 commit 64dfbfd

File tree

2 files changed

+28
-12
lines changed

2 files changed

+28
-12
lines changed

k6/scripts/articles-performance.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,20 @@ const requestFailRate = new Rate("request_fails");
99

1010
export const options = {
1111
//discardResponseBodies: true, // 응답 본문을 무시 할 수 있는 옵션으로 `data_received` 크기가 너무 커서 아웃 바운드 요금 초과 방지
12-
stages: [
13-
{ duration: "2m", target: 3000 }, // 최대 부하 유지
14-
{ duration: "1m", target: 0 }, // 빠르게 부하 감소
15-
],
12+
scenarios: {
13+
ramping_requests: {
14+
executor: "ramping-arrival-rate",
15+
timeUnit: "1s",
16+
stages: [
17+
{ duration: "2m", target: 800 },
18+
{ duration: "1m", target: 0 },
19+
],
20+
preAllocatedVUs: 100, // 초기 VU
21+
maxVUs: 400, // 필요에 따라 동적으로 추가
22+
},
23+
},
1624
tags: {
17-
testName: "prod-spike-articles-10",
25+
testName: "prod-spike-articles-22",
1826
testType: "spike",
1927
component: "articles",
2028
version: "1.0",
@@ -57,5 +65,5 @@ export default function () {
5765
requestFailRate.add(1);
5866
}
5967

60-
sleep(1);
68+
sleep(0.01);
6169
}

k6/scripts/participations-performance.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,20 @@ const requestFailRate = new Rate("request_fails");
99

1010
export const options = {
1111
//discardResponseBodies: true, // 응답 본문을 무시 할 수 있는 옵션으로 `data_received` 크기가 너무 커서 아웃 바운드 요금 초과 방지
12-
stages: [
13-
{ duration: "2m", target: 3000 }, // 최대 부하 유지
14-
{ duration: "1m", target: 0 }, // 빠르게 부하 감소
15-
],
12+
scenarios: {
13+
ramping_requests: {
14+
executor: "ramping-arrival-rate",
15+
timeUnit: "1s",
16+
stages: [
17+
{ duration: "2m", target: 1000 },
18+
{ duration: "1m", target: 0 },
19+
],
20+
preAllocatedVUs: 100, // 초기 VU
21+
maxVUs: 400, // 필요에 따라 동적으로 추가
22+
},
23+
},
1624
tags: {
17-
testName: "prod2-spike-participations-2",
25+
testName: "prod4-spike-participations-4",
1826
testType: "spike",
1927
component: "participations",
2028
version: "1.0",
@@ -59,5 +67,5 @@ export default function () {
5967
requestFailRate.add(1);
6068
}
6169

62-
sleep(1);
70+
sleep(0.01); // sleep 1초 설정 때문에 VUs가 유휴 상태가 되었던 문제...
6371
}

0 commit comments

Comments
 (0)