Skip to content

Commit

Permalink
[BE] Artillary 시나리오 작성 및 테스트 수행 (#19)
Browse files Browse the repository at this point in the history
* chore: Artillary 환경설정

* refactor: GameEvents 파일shared로 이동

* chore: scripts 작성

* test: 시나리오 테스트 작성

* test: 시나리오 테스트 결과 저장본
  • Loading branch information
glaxyt authored Jan 22, 2025
1 parent e9d9324 commit 2690bef
Show file tree
Hide file tree
Showing 4 changed files with 336 additions and 0 deletions.
277 changes: 277 additions & 0 deletions packages/server/connect-test-report.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,277 @@
{
"aggregate": {
"counters": {
"vusers.created_by_name.Test Messages with 32 Participants": 320,
"vusers.created": 320,
"socketio.emit": 3520,
"vusers.failed": 0,
"vusers.completed": 320
},
"rates": {
"socketio.emit_rate": 160
},
"firstCounterAt": 1737478986615,
"firstHistogramAt": 1737478986629,
"lastCounterAt": 1737479006761,
"lastHistogramAt": 1737479006761,
"firstMetricAt": 1737478986615,
"lastMetricAt": 1737479006761,
"period": 1737479000000,
"summaries": {
"socketio.response_time": {
"min": 0,
"max": 10.7,
"count": 3520,
"mean": 0.2,
"p50": 0.1,
"median": 0.1,
"p75": 0.2,
"p90": 0.3,
"p95": 0.4,
"p99": 0.7,
"p999": 3
},
"vusers.session_length": {
"min": 10002.9,
"max": 10057,
"count": 320,
"mean": 10012,
"p50": 9999.2,
"median": 9999.2,
"p75": 9999.2,
"p90": 9999.2,
"p95": 9999.2,
"p99": 9999.2,
"p999": 9999.2
}
},
"histograms": {
"socketio.response_time": {
"min": 0,
"max": 10.7,
"count": 3520,
"mean": 0.2,
"p50": 0.1,
"median": 0.1,
"p75": 0.2,
"p90": 0.3,
"p95": 0.4,
"p99": 0.7,
"p999": 3
},
"vusers.session_length": {
"min": 10002.9,
"max": 10057,
"count": 320,
"mean": 10012,
"p50": 9999.2,
"median": 9999.2,
"p75": 9999.2,
"p90": 9999.2,
"p95": 9999.2,
"p99": 9999.2,
"p999": 9999.2
}
}
},
"intermediate": [
{
"counters": {
"vusers.created_by_name.Test Messages with 32 Participants": 107,
"vusers.created": 107,
"socketio.emit": 343
},
"rates": {
"socketio.emit_rate": 110
},
"socketio.emit_rate": null,
"firstCounterAt": 1737478986615,
"firstHistogramAt": 1737478986629,
"lastCounterAt": 1737478989991,
"lastHistogramAt": 1737478989991,
"firstMetricAt": 1737478986615,
"lastMetricAt": 1737478989991,
"period": "1737478980000",
"summaries": {
"socketio.response_time": {
"min": 0,
"max": 0.8,
"count": 343,
"mean": 0.1,
"p50": 0.1,
"median": 0.1,
"p75": 0.2,
"p90": 0.2,
"p95": 0.3,
"p99": 0.7,
"p999": 0.8
}
},
"histograms": {
"socketio.response_time": {
"min": 0,
"max": 0.8,
"count": 343,
"mean": 0.1,
"p50": 0.1,
"median": 0.1,
"p75": 0.2,
"p90": 0.2,
"p95": 0.3,
"p99": 0.7,
"p999": 0.8
}
}
},
{
"counters": {
"vusers.created_by_name.Test Messages with 32 Participants": 213,
"vusers.created": 213,
"socketio.emit": 2571,
"vusers.failed": 0,
"vusers.completed": 107
},
"rates": {
"socketio.emit_rate": 263
},
"socketio.emit_rate": null,
"firstCounterAt": 1737478990015,
"firstHistogramAt": 1737478990018,
"lastCounterAt": 1737478999996,
"lastHistogramAt": 1737478999996,
"firstMetricAt": 1737478990015,
"lastMetricAt": 1737478999996,
"period": "1737478990000",
"summaries": {
"socketio.response_time": {
"min": 0,
"max": 10.7,
"count": 2571,
"mean": 0.2,
"p50": 0.1,
"median": 0.1,
"p75": 0.2,
"p90": 0.3,
"p95": 0.3,
"p99": 0.7,
"p999": 3.3
},
"vusers.session_length": {
"min": 10002.9,
"max": 10027.1,
"count": 107,
"mean": 10009.5,
"p50": 9999.2,
"median": 9999.2,
"p75": 9999.2,
"p90": 9999.2,
"p95": 9999.2,
"p99": 9999.2,
"p999": 9999.2
}
},
"histograms": {
"socketio.response_time": {
"min": 0,
"max": 10.7,
"count": 2571,
"mean": 0.2,
"p50": 0.1,
"median": 0.1,
"p75": 0.2,
"p90": 0.3,
"p95": 0.3,
"p99": 0.7,
"p999": 3.3
},
"vusers.session_length": {
"min": 10002.9,
"max": 10027.1,
"count": 107,
"mean": 10009.5,
"p50": 9999.2,
"median": 9999.2,
"p75": 9999.2,
"p90": 9999.2,
"p95": 9999.2,
"p99": 9999.2,
"p999": 9999.2
}
}
},
{
"counters": {
"socketio.emit": 606,
"vusers.failed": 0,
"vusers.completed": 213
},
"rates": {
"socketio.emit_rate": 110
},
"socketio.emit_rate": null,
"firstCounterAt": 1737479000022,
"firstHistogramAt": 1737479000022,
"lastCounterAt": 1737479006761,
"lastHistogramAt": 1737479006761,
"firstMetricAt": 1737479000022,
"lastMetricAt": 1737479006761,
"period": "1737479000000",
"summaries": {
"socketio.response_time": {
"min": 0,
"max": 1,
"count": 606,
"mean": 0.2,
"p50": 0.2,
"median": 0.2,
"p75": 0.3,
"p90": 0.4,
"p95": 0.5,
"p99": 0.7,
"p999": 0.9
},
"vusers.session_length": {
"min": 10004.6,
"max": 10057,
"count": 213,
"mean": 10013.3,
"p50": 9999.2,
"median": 9999.2,
"p75": 9999.2,
"p90": 9999.2,
"p95": 9999.2,
"p99": 9999.2,
"p999": 9999.2
}
},
"histograms": {
"socketio.response_time": {
"min": 0,
"max": 1,
"count": 606,
"mean": 0.2,
"p50": 0.2,
"median": 0.2,
"p75": 0.3,
"p90": 0.4,
"p95": 0.5,
"p99": 0.7,
"p999": 0.9
},
"vusers.session_length": {
"min": 10004.6,
"max": 10057,
"count": 213,
"mean": 10013.3,
"p50": 9999.2,
"median": 9999.2,
"p75": 9999.2,
"p90": 9999.2,
"p95": 9999.2,
"p99": 9999.2,
"p999": 9999.2
}
}
}
]
}
28 changes: 28 additions & 0 deletions packages/server/connect-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
config:
target: 'ws://localhost:3000/game'
phases:
- duration: 10
arrivalRate: 32 # 32명의 참여자
socketio:
transports: ['websocket']

scenarios:
- name: 'Test Messages with 32 Participants'
engine: 'socketio'
flow:
# 1. 각 클라이언트가 'session' 이벤트를 통해 핀코드에 참여
- emit:
channel: 'session'
data:
pinCode: 'a378ad' # 고정된 pinCode
nickname: 'TestUser_{{ $loopIndex }}'
# 2. 참여자가 1초 간격으로 'message' 이벤트 발생
- loop:
- emit:
channel: 'message'
data:
pinCode: 'a378ad'
message: 'Message from User {{ $loopIndex }}'
position: { { $loopIndex } }
- think: 1 # 1초 간격으로 메시지 발생
count: 10 # 각 참여자가 10번 메시지 전송
30 changes: 30 additions & 0 deletions packages/server/message-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
config:
target: 'ws://localhost:3000/game'
phases:
- duration: 30 # 총 30초 동안 테스트 진행
arrivalCount: 32 # 32명의 유저를 한 번에 생성
socketio:
transports: ['websocket']

scenarios:
- name: 'Test 32 Participants with Periodic Messages'
engine: 'socketio'
flow:
# 1. 각 클라이언트가 'session' 이벤트를 통해 핀코드에 참여
- emit:
channel: 'session'
data:
pinCode: '032233' # 고정된 pinCode
nickname: 'TestUser_{{ $loopIndex }}'
- think: 1 # 세션 등록 후 1초 대기

# 2. 각 참여자가 주기적으로 메시지를 보냄
- loop:
- emit:
channel: 'message'
data:
pinCode: '032233'
message: 'Message from User {{ $loopIndex }}'
position: { { $loopIndex } }
- think: 2 # 2초 간격으로 메시지 발생
count: 15 # 각 참여자가 15번 메시지 전송
1 change: 1 addition & 0 deletions packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"scripts": {
"start": "ts-node -r tsconfig-paths/register src/main.ts",
"start:dev": "nodemon --watch src --exec 'ts-node -r tsconfig-paths/register' src/main.ts",
"test:artillery": "artillery run message-test.yml -o message-test-report.json",
"build": "tsc && tsc-alias",
"test": "jest",
"test:e2e": "jest --config ./test/jest-e2e.json"
Expand Down

0 comments on commit 2690bef

Please sign in to comment.