Triton
Triton Inference Server
NVIDIA의 고성능 ML 모델 서빙 플랫폼. 멀티 프레임워크, 멀티 모델 지원으로 프로덕션 AI 배포의 표준입니다.
Triton Inference Server
NVIDIA의 고성능 ML 모델 서빙 플랫폼. 멀티 프레임워크, 멀티 모델 지원으로 프로덕션 AI 배포의 표준입니다.
Triton Inference Server는 NVIDIA가 개발한 오픈소스 AI 모델 서빙 플랫폼입니다. TensorFlow, PyTorch, ONNX, TensorRT 등 다양한 프레임워크의 모델을 단일 서버에서 동시에 서빙할 수 있어, 프로덕션 환경에서 AI 추론 워크로드를 효율적으로 관리할 수 있습니다.
Triton은 2018년 TensorRT Inference Server로 시작하여, 멀티 프레임워크 지원을 위해 2020년 Triton으로 리브랜딩되었습니다. 현재 클라우드, 데이터센터, 엣지, 임베디드 환경을 모두 지원하며, NVIDIA GPU뿐 아니라 x86/ARM CPU, AWS Inferentia에서도 동작합니다.
핵심 기능으로는 Dynamic Batching(요청을 자동으로 배치 처리), Model Ensemble(여러 모델 연결), Model Versioning(버전 관리), Concurrent Model Execution(동시 모델 실행)이 있습니다. 특히 Dynamic Batching은 개별 요청을 묶어 GPU 활용률을 극대화하여 처리량을 수 배 향상시킵니다.
실무에서 Triton은 대규모 AI 서비스의 핵심 인프라입니다. Grab, PayPal 등 글로벌 기업들이 Triton으로 추론 인프라를 통합하여 운영 복잡성을 줄이고, MLPerf Inference 벤치마크에서 최고 수준의 성능을 입증하고 있습니다.
2025년 1월 기준 Triton Inference Server 성능 및 특징입니다.
| 항목 | 내용 |
|---|---|
| 라이선스 | 오픈소스 (무료, BSD-3 License) |
| MLPerf v4.1 (Llama 2 70B) | H200 8대에서 bare-metal 동등 성능 |
| GPU vs CPU 성능비 | T4 GPU가 CPU 대비 37배 가성비 (BERT large) |
| Dynamic Batching 효과 | 처리량 2-5배 향상 |
| 지원 프레임워크 | TensorRT, PyTorch, ONNX, TensorFlow, vLLM 등 |
| 프로토콜 | HTTP/REST, gRPC, C API |
* Triton은 무료 오픈소스이나, GPU 인프라 비용은 별도입니다. NVIDIA AI Enterprise 구독 시 엔터프라이즈 지원을 받을 수 있습니다.
Triton Inference Server 배포 및 Python 클라이언트 예제입니다.
# 1. Triton 서버 실행 (Docker)
# docker run --gpus all -p 8000:8000 -p 8001:8001 -p 8002:8002 \
# -v /path/to/models:/models \
# nvcr.io/nvidia/tritonserver:24.01-py3 \
# tritonserver --model-repository=/models
# 2. Python 클라이언트로 추론 요청
import tritonclient.http as httpclient
import numpy as np
# Triton 서버 연결
client = httpclient.InferenceServerClient(url="localhost:8000")
# 서버 상태 확인
if client.is_server_live():
print("Triton 서버 정상 작동 중")
# 모델 정보 확인
model_name = "bert_onnx"
model_metadata = client.get_model_metadata(model_name)
print(f"모델: {model_metadata['name']}, 버전: {model_metadata['versions']}")
# 입력 데이터 준비
input_ids = np.array([[101, 2023, 2003, 1037, 3231, 102]], dtype=np.int64)
attention_mask = np.array([[1, 1, 1, 1, 1, 1]], dtype=np.int64)
# 추론 입력 설정
inputs = [
httpclient.InferInput("input_ids", input_ids.shape, "INT64"),
httpclient.InferInput("attention_mask", attention_mask.shape, "INT64")
]
inputs[0].set_data_from_numpy(input_ids)
inputs[1].set_data_from_numpy(attention_mask)
# 추론 출력 설정
outputs = [httpclient.InferRequestedOutput("output")]
# 추론 실행
response = client.infer(model_name, inputs, outputs=outputs)
# 결과 확인
output_data = response.as_numpy("output")
print(f"추론 결과 shape: {output_data.shape}")
print(f"추론 결과: {output_data[:5]}") # 상위 5개 값
# 성능 통계 확인
statistics = client.get_inference_statistics(model_name)
print(f"총 추론 횟수: {statistics['model_stats'][0]['inference_count']}")
print(f"평균 추론 시간: {statistics['model_stats'][0]['inference_stats']['success']['compute_infer']['avg']/1e6:.2f}ms")
각 모델 폴더에 config.pbtxt가 없으면 로드 실패합니다. 입출력 shape, 데이터 타입을 정확히 명시하세요.
기본 설정은 배치 처리가 비활성화되어 GPU 효율이 낮습니다. max_batch_size와 preferred_batch_size를 반드시 설정하세요.
Model Analyzer로 최적 배치 크기 탐색, Perf Analyzer로 성능 벤치마크, Prometheus/Grafana로 모니터링을 구축하세요.