Skip to main content
Deprecation Notice: ONNX Runtime Server has been deprecated and is no longer actively maintained. For production deployments, consider alternatives like:
  • Triton Inference Server with ONNX Runtime backend
  • Custom REST APIs using ONNX Runtime SDKs
  • Cloud-native solutions (Azure ML, AWS SageMaker, etc.)

Overview

ONNX Runtime Server provided an easy way to start an inferencing server with both HTTP and GRPC endpoints. While deprecated, this documentation is maintained for reference.

Building ONNX Runtime Server

Prerequisites

  1. golang
  2. grpc
  3. re2
  4. cmake
  5. gcc and g++
  6. ONNX Runtime C API binaries from GitHub releases

Build Instructions (Linux)

With rsyslog Support

Using Build Script

Starting the Server

Basic Usage

Command Line Options

Example

HTTP Endpoint

Prediction URL Format

Example:
Note: Model name and version can be any string (length > 0).

Request and Response Format

Requests and responses use Protocol Buffers format. The protobuf definition is available in server/protobuf/predict.proto.

Content Types

Request Headers

The Content-Type header is required:
  • application/json - JSON format (UTF-8)
  • application/vnd.google.protobuf - Binary protobuf
  • application/x-protobuf - Binary protobuf
  • application/octet-stream - Binary protobuf

Response Format

Set the Accept header to control response format:
  • Same options as Content-Type
  • Defaults to request content type if not specified

Making HTTP Requests

Using cURL (JSON)

Using cURL (Binary)

Using Python

GRPC Endpoint

Protobuf Definition

The GRPC service definition is available in server/protobuf/prediction_service.proto.

Python GRPC Client

Advanced Configuration

Number of Worker Threads

Control server utilization with worker threads:

Request Tracking Headers

The server provides headers for request tracking:
  • x-ms-request-id: Server-generated GUID for each request (e.g., 72b68108-18a4-493c-ac75-d0abd82f0a11)
  • x-ms-client-request-id: Client-provided ID that persists in response

Example

rsyslog Integration

If built with rsyslog support:
Configure rsyslog in /etc/rsyslog.conf or /etc/rsyslog.d/.

Production Deployment

Docker Deployment

Build and run:

Kubernetes Deployment

Load Balancing

Use nginx for load balancing:

Performance Tuning

Thread Configuration

Model Optimization

  1. Convert to ORT format for faster loading
  2. Use graph optimization level ‘all’
  3. Consider quantization for INT8 inference

Monitoring and Debugging

Health Check Endpoint

Implement custom health checks:

Logging Levels

Migration Guide

Moving to Triton Inference Server

Triton supports ONNX Runtime as a backend:
  1. Install Triton: Use official Docker images
  2. Configure model repository:
  3. config.pbtxt:
  4. Start Triton:

Resources