Contents

Chapter 1

Deployment Guide

Local Development

bash
pip install -r requirements.txt
uvicorn src.serving_app:create_app --factory --reload --port 8000

Docker

dockerfile
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY src/ src/
COPY configs/ configs/
EXPOSE 8000
CMD ["uvicorn", "src.serving_app:create_app", "--factory", "--host", "0.0.0.0", "--port", "8000"]

Build and run:

bash
docker build -t model-server .
docker run -p 8000:8000 -v $(pwd)/models:/app/models model-server

Kubernetes

yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: model-server
spec:
  replicas: 3
  selector:
    matchLabels:
      app: model-server
  template:
    metadata:
      labels:
        app: model-server
    spec:
      containers:
        - name: server
          image: your-registry.docs.example.com/model-server:latest
          ports:
            - containerPort: 8000
          livenessProbe:
            httpGet:
              path: /health
              port: 8000
            initialDelaySeconds: 10
            periodSeconds: 15
          readinessProbe:
            httpGet:
              path: /ready
              port: 8000
            initialDelaySeconds: 5
            periodSeconds: 10
          resources:
            requests:
              memory: "512Mi"
              cpu: "500m"
            limits:
              memory: "2Gi"
              cpu: "2"

API Usage

Single Prediction

bash
curl -X POST http://localhost:8000/predict \
  -H "Content-Type: application/json" \
  -d '{"features": {"age": 35, "income": 55000, "region": "north"}}'

Batch Prediction

bash
curl -X POST http://localhost:8000/predict/batch \
  -H "Content-Type: application/json" \
  -d '{"instances": [{"age": 35, "income": 55000}, {"age": 42, "income": 72000}]}'

A/B Test Override

bash
curl -X POST http://localhost:8000/predict \
  -H "Content-Type: application/json" \
  -H "X-Model-Version: canary_model" \
  -d '{"features": {"age": 35, "income": 55000}}'
Chapter 2
🔒 Available in full product

Scaling Guide

Chapter 3
🔒 Available in full product

Deployment Guide

You’ve reached the end of the free preview

Get the full Model Serving Toolkit and unlock everything.

All Chapters

Get the complete guide with every chapter unlocked, including code samples, diagrams, and best practices.

Full Tool Suite

Access all interactive tools with complete data, all workload profiles, and the full scenario library.

Source Files

Downloadable source code, configuration files, and working examples from every chapter.

Lifetime Updates

Free updates for life. Every new chapter, tool, and improvement included.

Buy Now — $39 →
📦 Free sample included — download another copy or visit the store for the full product.
Model Serving Toolkit v1.0.0 — Free Preview