WEBBOOK CHAPTER

웹서비스 개발 도구 상자: 12장. curl timing으로 느린 구간을 자른다

12장. curl timing으로 느린 구간을 자른다

총 시간만 보지 말고 name lookup, connect, TLS, first byte, total을 나눈다. 같은 endpoint를 여러 번 측정해 connection reuse와 cache를 표시한다.

DNS부터 download까지 HTTP 요청 시간을 분해한 그림
DNS부터 download까지 HTTP 요청 시간을 분해한 그림

curl -o /dev/null -sS 
  -w 'dns=%{time_namelookup} connect=%{time_connect} tls=%{time_appconnect} ttfb=%{time_starttransfer} total=%{time_total}n' 
  https://api.example.test/health

TTFB가 길면 app·DB·downstream trace로 넘어간다. DNS가 길면 resolver로 간다. timeout을 늘리기 전에 어느 구간이 초과했는지 확인한다.