Tech Stack

부하테스트 실행 결과

seongjunnoh@seongjunnohui-noteubug loadtest % k6 run room_join_load_test.js

         /\\      Grafana   /‾‾/                                                                                                                                                                                
    /\\  /  \\     |\\  __   /  /                                                                                                                                                                                 
   /  \\/    \\    | |/ /  /   ‾‾\\                                                                                                                                                                               
  /          \\   |   (  |  (‾)  |                                                                                                                                                                              
 / __________ \\  |_|\\_\\  \\_____/ 

     execution: local
        script: room_join_load_test.js
        output: -

     scenarios: (100.00%) 1 scenario, 500 max VUs, 10m5s max duration (incl. graceful stop):
              * join_once_burst: 1 iterations for each of 500 VUs (maxDuration: 10m0s, gracefulStop: 5s)

  █ THRESHOLDS 

    **rooms_join_5xx
    ✗ 'count==0' count=120

    rooms_join_latency
    ✗ 'p(95)<1000' p(95)=34517.5511**

  █ TOTAL RESULTS 

    checks_total.......................: 1000   23.435273/s
    checks_succeeded...................: 88.00% 880 out of 1000
    checks_failed......................: 12.00% 120 out of 1000

    ✓ join responded
    ✗ join 200 or expected 4xx
      ↳  76% — ✓ 380 / ✗ 120

    CUSTOM
    fail_ROOM_MEMBER_COUNT_EXCEEDED.........................................: 364    8.530439/s
    rooms_join_2xx..........................................................: 16     0.374964/s
    rooms_join_4xx..........................................................: 364    8.530439/s
    rooms_join_5xx..........................................................: 120    2.812233/s
    rooms_join_latency......................................................: avg=27936.991638 min=10569.233 med=29669.9935 max=34718.465 p(90)=33880.2578 p(95)=34517.5511

    HTTP
    http_req_duration.......................................................: avg=13.97s       min=1.28ms    med=5.46s      max=34.71s    p(90)=33.27s     p(95)=33.87s    
      { expected_response:true }............................................: avg=617.51ms     min=1.28ms    med=5.52ms     max=27.21s    p(90)=76.61ms    p(95)=229.53ms  
    http_req_failed.........................................................: 48.40% 484 out of 1000
    http_reqs...............................................................: 1000   23.435273/s

    EXECUTION
    iteration_duration......................................................: avg=33.11s       min=15.63s    med=34.81s     max=40.18s    p(90)=39.06s     p(95)=39.57s    
    iterations..............................................................: 500    11.717636/s
    vus.....................................................................: 49     min=0           max=500
    vus_max.................................................................: 500    min=500         max=500

    NETWORK
    data_received...........................................................: 525 kB 12 kB/s
    data_sent...............................................................: 220 kB 5.2 kB/s

running (00m42.7s), 000/500 VUs, 500 complete and 0 interrupted iterations
join_once_burst ✓ [======================================] 500 VUs  00m40.2s/10m0s  500/500 iters, 1 per VU
ERRO[0043] thresholds on metrics 'rooms_join_5xx, rooms_join_latency' have been crossed 


⇒ 우선 5xx error 발생 원인을 찾아서 이를 해결해야한다

⇒ 로그를 보았을때 deadlock 발생으로 인해 5xx error가 발생한 듯 하다

<aside> 💡

[Deadlock found when trying to get lock; try restarting transaction] [update rooms set book_id=?,category=?,description=?,end_date=?,is_public=?,member_count=?,modified_at=?,password=?,recruit_count=?,room_percentage=?,room_status=?,start_date=?,status=?,title=? where room_id=?]; SQL [update rooms set book_id=?,category=?,description=?,end_date=?,is_public=?,member_count=?,modified_at=?,password=?,recruit_count=?,room_percentage=?,room_status=?,start_date=?,status=?,title=? where room_id=?]

</aside>

부하테스트 과정에서 발견된 데드락 상황의 원인 정리

실제 THIP 코드로 확인

s-lock 획득 시점 파악