취미가 좋다
[ Server ] Trace 본문
Triton Server Trace
triton은 각 inference 요청에 대해 자세한 trace를 생성할 수 있다.
실행 가능한 tritonserver를 실행시킬 때, 아래의 arguments를 지정해주면 된다.
$ tritonserver --trace-file=/tmp/trace.json --trace-rate=100 --trace-level=MAX ...
--trace-file : trace output이 저장될 위치를 가리킨다.
--trace-rate : 샘플링 주기를 가리킨다.
--trace-level : trace 정보를 얼마나 자세하게 모을지에 대한 수준이다.
--help : 더 자세한 옵션 정보를 볼 수 있다.
JSON Trace Output
trace output으로 생성되는 JSON 파일은 아래의 구조를 가진다.
[
{
"model_name": $string,
"model_version": $number,
"id": $number
"parent_id": $number,
"timestamps": [
{ "name" : $string, "ns" : $number },
...
]
},
...
]
각 trace는 요청에 대한 모델 이름과 버전 정보를 가지고 있고, 유티크한 Id 를 가진다.
만약 앙상블에 포함된 모델에 대한 trace라면, parent id 가 모델을 포함하고 있는 앙상블의 id를 가리킬 것이다.
각 trace는 하나 그 이상의 timestamps 를 가지고, 각 timestamp 는 이름과 nanoseconds 단위의 시간이 저장되어 있다.
[
{
"model_name": "simple",
"model_version": -1,
"id":1,
"timestamps" : [
{ "name": "http recv start", "ns": 2259961222771924 },
{ "name": "http recv end", "ns": 2259961222820985 },
{ "name": "request handler start", "ns": 2259961223164078 },
{ "name": "queue start", "ns": 2259961223182400 },
{ "name": "compute start", "ns": 2259961223232405 },
{ "name": "compute end", "ns": 2259961230206777 },
{ "name": "request handler end", "ns": 2259961230211887 },
{ "name": "http send start", "ns": 2259961230529606 },
{ "name": "http send end", "ns": 2259961230543930 }
]
}
]
Trace Summary Tool
triton으로 부터 모은 trace들을 요약할 수 있는 툴이 있고 아래의 코드로 간단히 실행할 수 있다.
$ trace_summary.py <trace file>
이 과정은 파일에 있는 모든 traces 에 대한 요약을 제공하고, HTTP 와 GRPC 요청을 나누어 보여준다.
File: trace.json
Summary for simple (-1): trace count = 1
HTTP infer request (avg): 378us
Receive (avg): 21us
Send (avg): 7us
Overhead (avg): 79us
Handler (avg): 269us
Overhead (avg): 11us
Queue (avg): 15us
Compute (avg): 242us
Input (avg): 18us
Infer (avg): 208us
Output (avg): 15us
Summary for simple (-1): trace count = 1
GRPC infer request (avg): 21441us
Wait/Read (avg): 20923us
Send (avg): 74us
Overhead (avg): 46us
Handler (avg): 395us
Overhead (avg): 16us
Queue (avg): 47us
Compute (avg): 331us
Input (avg): 30us
Infer (avg): 286us
Output (avg): 14us
각 timestamps 의 의미는 아래와 같다.
- GRPC Request Wait/Read
- HTTP Request Receive
- Send : 응답을 보내는데 소요된 시간
- Overhead
- Handler : 요청을 handling 하는 데 총 걸린 시간 (HTTP, GRPC request/response handling 제외)
- Queue : 요청이 scheduling queue에 있는 시간
- Compute : 요청이 실제 inference 를 실행하는데 걸린 시간. (input, output tensor 를 복사하는 시간 포함)
- Input : input tensor data를 inference framework/backend 로 복사하는데 걸린 시간. (텐서 데이터를 GPU에 올리는 시간을 포함)
- Infer : inference를 위해 모델을 실행시킨 시간
- Output : output tensor data를 inference framework/backend 에서 복사하는데 걸린 시간. (텐서 데이터를 GPU에서 가져오는 시간을 포함)
- Overhead : reqest handling 시간 중 Queue, Compute 를 제외한 시간
-t 옵션을 사용하면, 파일의 각 trace에 대한 요약을 보여준다.
두 point 사이의 시간을 microseconds 단위로 보여준다.
예를 들어, 아래에서 request handling 의 시작부터 scheduling queue에 들어갈 때까지 15us 가 소요되었다.
$ trace_summary.py -t <trace file>
...
simple (-1):
grpc wait/read start
26529us
grpc wait/read end
39us
request handler start
15us
queue start
20us
compute start
266us
compute end
4us
request handler end
19us
grpc send start
77us
grpc send end
...
'Data Engineer > triton inference server' 카테고리의 다른 글
[ Server ] Model Analyzer (0) | 2021.06.28 |
---|---|
Triton Inference Server Backend (0) | 2021.06.24 |
[ Server ] Performance Analyzer (0) | 2021.06.24 |
[ Server ] Metrics (0) | 2021.06.24 |
[ Server ] Architecture (0) | 2021.06.24 |