|
1 | 1 | import http from 'k6/http'; |
2 | | -import { check, sleep, group } from 'k6'; |
| 2 | +import { check, group, sleep } from 'k6'; |
3 | 3 |
|
4 | 4 | export const options = { |
5 | 5 | stages: [ |
6 | | - { duration: '1m', target: 50 }, // 1분 동안 VU 50명 유지 |
7 | | - { duration: '1m', target: 100 }, // 1분 동안 VU 100명 유지 |
8 | | - { duration: '1m', target: 300 }, // 1분 동안 VU 200명 유지 |
9 | | - { duration: '1m', target: 500 }, // 1분 동안 VU 300명 유지 |
10 | | - { duration: '1m', target: 700 }, // 1분 동안 VU 500명 유지 |
11 | | - { duration: '1m', target: 1000 }, // 1분 동안 VU 500명 유지 |
12 | | - { duration: '1m', target: 0 }, // 점진적 종료 |
| 6 | + { duration: '2m', target: 100 }, // stay at 52 VUs |
| 7 | + { duration: '1m', target: 200 }, // ramp-up to 517 VUs (peak time) |
| 8 | + { duration: '2m', target: 300 }, // stay at 517 VUs |
| 9 | + { duration: '1m', target: 500 }, // ramp-down to 52 VUs |
| 10 | + { duration: '2m', target: 700 }, // ramp-down to 52 VUs |
| 11 | + { duration: '2m', target: 900 }, // ramp-down to 52 VUs |
| 12 | + { duration: '1m', target: 0 }, // ramp-down to 0 |
13 | 13 | ], |
14 | 14 | }; |
15 | 15 |
|
16 | 16 | const BASE_URL = 'http://spring:8080'; |
17 | 17 |
|
18 | 18 | export default function () { |
19 | | - // 강북구 고정 좌표 |
| 19 | + // 1. 클러스터형 조회 API 먼저 호출 |
| 20 | + clusterRequest(); |
| 21 | + |
| 22 | + // 2. 그 다음 마커형 개별 다이어리 조회 API 호출 |
| 23 | + markerRequest(); |
| 24 | + |
| 25 | + // (optional) sleep 추가 |
| 26 | + sleep(1); |
| 27 | +} |
| 28 | + |
| 29 | +function clusterRequest() { |
| 30 | + //서울특별시 전체를 커버할 수 있는 남, 북, 동, 서 좌표 범위 |
20 | 31 | const bounds = { |
21 | | - south: 33.0, |
22 | | - north: 39.5, |
23 | | - west: 124.01, |
24 | | - east: 131.0, |
25 | | - zoom: 1 |
| 32 | + south: 37.4133, |
| 33 | + north: 37.7014, |
| 34 | + west: 126.7341, |
| 35 | + east: 127.2693, |
| 36 | + zoom: 12 |
26 | 37 | }; |
27 | 38 |
|
28 | 39 | const url = `${BASE_URL}/maps/diaries/cluster?south=${bounds.south}&north=${bounds.north}&west=${bounds.west}&east=${bounds.east}&zoom=${bounds.zoom}`; |
29 | 40 |
|
30 | | - group('Get Diary Clusters (Gangbuk-gu fixed bounds)', () => { |
31 | | - const res = http.get(url, { |
32 | | - headers: { |
33 | | - 'Content-Type': 'application/json', |
34 | | - }, |
35 | | - }); |
| 41 | + const res = http.get(url, { |
| 42 | + headers: { |
| 43 | + 'Content-Type': 'application/json', |
| 44 | + }, |
| 45 | + }); |
| 46 | + |
| 47 | + check(res, { |
| 48 | + 'Cluster API 응답 성공': (r) => r.status === 200, |
| 49 | + }); |
| 50 | + |
| 51 | + console.log(`클러스터 조회 응답 시간: ${res.timings.duration} ms`); |
| 52 | +} |
36 | 53 |
|
| 54 | +function markerRequest() { |
| 55 | + // 강동구 중심 좌표를 기준으로 소범위 설정 |
| 56 | + const bounds = { |
| 57 | + south: 37.5459, |
| 58 | + north: 37.5559, |
| 59 | + west: 127.1644, |
| 60 | + east: 127.1744, |
| 61 | + }; |
37 | 62 |
|
38 | | - check(res, { |
39 | | - 'status is 200': (r) => r.status === 200, |
40 | | - }); |
| 63 | + const url = `${BASE_URL}/maps/diaries/marker?south=${bounds.south}&north=${bounds.north}&west=${bounds.west}&east=${bounds.east}`; |
41 | 64 |
|
42 | | - sleep(1); // 사용자당 요청 간격 |
| 65 | + const res = http.get(url, { |
| 66 | + headers: { |
| 67 | + 'Content-Type': 'application/json', |
| 68 | + }, |
43 | 69 | }); |
| 70 | + |
| 71 | + check(res, { |
| 72 | + 'Marker API 응답 성공': (r) => r.status === 200, |
| 73 | + }); |
| 74 | + |
| 75 | + console.log(`마커 조회 응답 시간: ${res.timings.duration} ms`); |
44 | 76 | } |
0 commit comments