JMeter는 GUI로도 실행이 가능하지만, 성능 테스트를 자동화하거나 리소스 사용을 줄이기 위해 CLI로 실행하는 경우가 많이 있다. 특히 Windows 서버에서 배치 작업이나 예약 테스트를 구성할 때 유용하게 활용된다.
이로 인해 해당 글에서는 Windows 서버에서 CLI 모드로 JMeter를 실행하고, 테스트 결과 리포트를 생성하는 방법까지 정리해 보려고 한다.
1. JMeter 설치
아래의 URL 참고
Apache JMeter란? 설치 및 실행 방법
JMeter란?Jmeter는 웹 애플리케이션의 성능 및 부하 테스트를 위해 개발된 도구이다. 현재는 웹 서버뿐만 아니라 데이터베이스, FTP 등 여러 프로토콜을 지원한다. 오픈소스이기 때문에 무료로 사용
yeit.tistory.com
2. 테스트 시나리오(.jmx) 준비
JMeter GUI에서 시나리오를 만들고 저장한다. (아래의 URL 참고)
Apache JMeter을 통한 성능 테스트 방법
JMeter란?Jmeter는 웹 애플리케이션의 성능 및 부하 테스트를 위해 개발된 도구이다. 현재는 웹 서버뿐만 아니라 데이터베이스, FTP 등 여러 프로토콜을 지원한다. 오픈소스이기 때문에 무료로 사용
yeit.tistory.com
3. CLI로 JMeter 실행하기
cmd에서 jmeter.bat 파일이 있는 경로로 이동한 후, jmeter.bat -n -t test.jmx -l result.jtl -e -o report 명령어를 입력하여 위에서 설정한 test.jmx 파일을 실행한다. 실행이 완료되면 result.jtl 파일이 생성된다.
- -n : Non-GUI 모드
- -t : 테스트 계획(.jmx) 파일 경로
- -l : 결과 파일(.jtl) 저장 경로
C:\Users\Administrator\Downloads\apache-jmeter-5.6.3\bin>jmeter.bat -n -t test.jmx -l result.jtl -e -o report
WARN StatusConsoleListener The use of package scanning to locate plugins is deprecated and will be removed in a future release
WARN StatusConsoleListener The use of package scanning to locate plugins is deprecated and will be removed in a future release
WARN StatusConsoleListener The use of package scanning to locate plugins is deprecated and will be removed in a future release
WARN StatusConsoleListener The use of package scanning to locate plugins is deprecated and will be removed in a future release
Creating summariser <summary>
Created the tree successfully using test.jmx
Starting standalone test @ May 20, 2025 2:24:18 PM KST (1747718658989)
Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port 4445
summary + 205 in 00:00:10 = 20.5/s Avg: 424 Min: 6 Max: 3354 Err: 0 (0.00%) Active: 10 Started: 10 Finished: 0
summary + 3510 in 00:00:30 = 116.9/s Avg: 253 Min: 4 Max: 2784 Err: 0 (0.00%) Active: 40 Started: 40 Finished: 0
summary = 3715 in 00:00:40 = 92.8/s Avg: 263 Min: 4 Max: 3354 Err: 0 (0.00%)
summary + 5080 in 00:00:30 = 171.1/s Avg: 351 Min: 6 Max: 2980 Err: 0 (0.00%) Active: 70 Started: 70 Finished: 0
summary = 8795 in 00:01:10 = 126.1/s Avg: 314 Min: 4 Max: 3354 Err: 0 (0.00%)
summary + 6221 in 00:00:30 = 207.3/s Avg: 430 Min: 4 Max: 3248 Err: 0 (0.00%) Active: 100 Started: 100 Finished: 0
summary = 15016 in 00:01:40 = 150.6/s Avg: 362 Min: 4 Max: 3354 Err: 0 (0.00%)
summary + 3693 in 00:00:10 = 355.4/s Avg: 265 Min: 2 Max: 3251 Err: 2333 (63.17%) Active: 0 Started: 100 Finished: 100
summary = 18709 in 00:01:50 = 169.9/s Avg: 343 Min: 2 Max: 3354 Err: 2333 (12.47%)
Tidying up ... @ May 20, 2025 2:26:10 PM KST (1747718770405)
... end of run
4. HTML 리포트 생성하기
테스트를 완료 후 jmeter.bat -g result.jtl -o report 명령어를 실행하여 추출된 result.jtl 파일을 기반으로 HTML 리포트를 생성한다. 생성된 report 폴더 안에 index.html이 있는 것을 확인할 수 있다.
- -g : .jtl 결과 파일 경로
- -o : HTML 리포트 출력 디렉토리
C:\Users\Administrator\Downloads\apache-jmeter-5.6.3\bin>jmeter.bat -g result.jtl -o report
WARN StatusConsoleListener The use of package scanning to locate plugins is deprecated and will be removed in a future release
WARN StatusConsoleListener The use of package scanning to locate plugins is deprecated and will be removed in a future release
WARN StatusConsoleListener The use of package scanning to locate plugins is deprecated and will be removed in a future release
WARN StatusConsoleListener The use of package scanning to locate plugins is deprecated and will be removed in a future release
An error occurred: Cannot write to 'C:\Users\Administrator\Downloads\apache-jmeter-5.6.3\bin\report' as folder is not empty
errorlevel=1
Press any key to continue . . .
C:\Users\Administrator\Downloads\apache-jmeter-5.6.3\bin>
5. index.html 파일
index.html파일을 열어보면 아래와 같이 리포트가 출력된 것을 볼 수 있다. 해당 리포트에서 응답시간, TPS 등 다양한 데이터 값들을 확인할 수 있다.
응답시간 : Charts > Over Time > Response Time Percentiles Over Time (successful responses)
TPS : Charts >Throughput > Transactions Per Second
Threads 수 : Charts > Over Time > Active Threads Over Time
'OS > Windows' 카테고리의 다른 글
[Windows] 윈도우 OS 기본 명령어 총정리_ 인프라 관리의 기초 (0) | 2024.08.17 |
---|---|
[Windows][업무자동화] Batch파일 활용 - 오늘 날짜에 해당하는 파일만 옮기기 (0) | 2024.05.25 |
[Windows][업무자동화] Batch파일 활용 - 파일 복사하기, 덮어쓰기 (0) | 2024.05.25 |
[Windows] 배치 파일 & 작업 스케줄러 방법 (0) | 2024.03.24 |
[Windows] wget 설치 방법 (0) | 2024.03.16 |