Skip to content

Latest commit

 

History

History
145 lines (108 loc) · 4.27 KB

06-verification.md

File metadata and controls

145 lines (108 loc) · 4.27 KB

06. 측정 + 검증

각 단계 적용 후, 그리고 전부 적용 후의 변화를 측정.

측정 항목

항목 도구 의미
정적 응답 시간 curl -w 또는 scripts/measure.sh 가장 직접적 지표
응답 시간 분포 wrk 또는 ab 단일 호출 외 분포까지
Apache 처리 vs Tomcat 처리 access_log 비교 Step 1 효과 확인
AJP 풀 사이즈 JMX / Manager Step 3 효과 확인
스왑 사용량 free -h 또는 scripts/swap-check.sh Step 4 효과 확인

응답 시간 측정 — curl

curl -w "@-" -o /dev/null -s "https://your-domain.example/resources/css/main.css" <<'EOF'
    time_namelookup:  %{time_namelookup}s\n
       time_connect:  %{time_connect}s\n
    time_appconnect:  %{time_appconnect}s\n
   time_pretransfer:  %{time_pretransfer}s\n
      time_redirect:  %{time_redirect}s\n
 time_starttransfer:  %{time_starttransfer}s\n
                    ----------\n
         time_total:  %{time_total}s\n
EOF

time_total이 응답 완료까지의 총 시간.

자동화 스크립트: scripts/measure.sh

./scripts/measure.sh https://your-domain.example/resources/css/main.css
# 5회 평균: 0.038s

응답 시간 분포 — wrk

단일 호출이 아닌 동시 부하 상황에서의 분포 측정.

# wrk 설치 (한 번만)
# Ubuntu: apt install wrk
# Mac: brew install wrk

wrk -t 4 -c 100 -d 30s https://your-domain.example/resources/css/main.css

출력 예시:

Running 30s test @ https://your-domain.example/resources/css/main.css
  4 threads and 100 connections
  Thread Stats   Avg      Stdev     Max
    Latency    42.3ms     8.1ms    105ms
    Req/Sec   591.20    50.43    750
  70812 requests in 30.00s
Transfer/sec: 25.6MB
  • Avg: 평균 응답
  • Stdev: 표준편차 (작을수록 안정적)
  • Max: 최악의 응답

본인 환경 측정 결과:

단계 Avg Stdev Max
적용 전 133ms 45ms 380ms
Step 1 후 75ms 22ms 180ms
Step 2 후 48ms 18ms 130ms
Step 3 후 40ms 12ms 95ms
Step 4 후 38ms 9ms 80ms

평균 3.5배 + 표준편차 5배 개선.

Apache vs Tomcat 처리 확인 (Step 1·2)

# 정적 리소스 요청 한 번
curl -I https://your-domain.example/resources/css/main.css

# Apache access_log에 찍혀야 함
tail -3 /usr/local/httpd/logs/access_log
# 1.2.3.4 - - [...] "GET /resources/css/main.css HTTP/1.1" 200 ...

# Tomcat access log에는 찍히지 않아야 함
tail -10 /usr/local/tomcat/logs/localhost_access_log.YYYY-MM-DD.log | grep main.css
# (출력 없음 - 정상)

AJP 풀 사이즈 확인 (Step 3)

옵션 A — Tomcat Manager 화면:

http://localhost:8080/manager/status?XML=true

<connector name="ajp-nio-8009"> 블록의 currentThreadCount / maxThreads 확인.

옵션 B — JMX:

# jconsole 또는 jmx_exporter
# MBean: Catalina:type=ThreadPool,name="ajp-nio-8009"
# - maxThreads: 800 (executor 공유 후)
# - currentThreadCount: 가변

스왑 사용량 (Step 4)

free -h
# Swap.used 가 1GB 이하 유지

./scripts/swap-check.sh
# OK: Swap usage X MB / Memory available Y MB

종합 결과 표 (본인 환경)

지표 적용 전 전부 적용 후 비율
정적 응답 시간 (평균) 0.133초 0.038초 3.5배
응답 시간 표준편차 45ms 9ms 5배
동시 처리 능력 (AJP) 200 스레드 800 (공유) 4배
스왑 사용량 2.3GB 1.1GB 52% 감소
Tomcat 처리 비중 (정적 리소스) 100% 0% 완전 분리

보고용 체크리스트

운영 환경 적용 후 다음 항목을 한 번씩 점검·기록:

  • 정적 응답 시간 (curl) 5회 평균 측정
  • 응답 시간 분포 (wrk 30초)
  • Apache access_log에 정적 리소스 기록 확인
  • Tomcat access log에 정적 리소스 없음 확인
  • AJP 풀 사이즈 800으로 통합 확인
  • 스왑 사용량 1GB 이하 확인
  • 다음 날 같은 시간대 재측정 (안정성 검증)

다음 문서 → 07-further-improvements.md: HTTP/2 · Lazy Loading · 이미지 최적화