> ## Documentation Index
> Fetch the complete documentation index at: https://docs.livepeer.org/llms.txt
> Use this file to discover all available pages before exploring further.

# BYOC production

> Production requirements for BYOC containers: GPU memory profiling, graceful shutdown, concurrent session handling, monitoring, and orchestrator configuration.

export const CenteredContainer = ({children, maxWidth = "800px", padding = "0", preset = "default", width = "", minWidth = "", marginRight = "", marginBottom = "", textAlign = "", style = {}, className = "", ...rest}) => {
  const presets = {
    default: {},
    fitContent: {
      width: "fit-content",
      minWidth: "fit-content"
    },
    readable70: {
      width: "70%",
      minWidth: "fit-content"
    },
    readable80: {
      width: "80%",
      minWidth: "fit-content"
    },
    readable90: {
      width: "90%"
    },
    wide900: {
      maxWidth: "900px"
    }
  };
  const presetStyle = presets[preset] || presets.default;
  return <div className={className} style={{
    maxWidth: presetStyle.maxWidth || maxWidth,
    margin: "0 auto",
    padding: padding,
    ...presetStyle.width ? {
      width: presetStyle.width
    } : {},
    ...presetStyle.minWidth ? {
      minWidth: presetStyle.minWidth
    } : {},
    ...width ? {
      width
    } : {},
    ...minWidth ? {
      minWidth
    } : {},
    ...marginRight ? {
      marginRight
    } : {},
    ...marginBottom ? {
      marginBottom
    } : {},
    ...textAlign ? {
      textAlign
    } : {},
    ...style
  }} {...rest}>
      {children}
    </div>;
};

export const CustomDivider = ({color = "var(--lp-color-border-default)", middleText = "", spacing = "default", style = {}, className = "", ...rest}) => {
  const spacingPresets = {
    default: {
      margin: "24px 0"
    },
    overlap: {
      margin: "-1rem 0 -1rem 0"
    },
    tight: {
      margin: "0 0 -1rem 0"
    },
    section: {
      margin: "0 0 -2rem 0"
    },
    sectionOverlap: {
      margin: "-1rem 0 -2rem 0"
    },
    deepOverlap: {
      margin: "-1rem 0 -1.5rem 0"
    }
  };
  const spacingStyle = spacingPresets[spacing] || spacingPresets.default;
  return <div role="separator" aria-orientation="horizontal" className={className} style={{
    display: "flex",
    alignItems: "center",
    ...spacingStyle,
    fontSize: style?.fontSize || "16px",
    height: "fit-content",
    ...style
  }} {...rest}>
      <span style={{
    marginRight: "var(--lp-spacing-px-8)",
    opacity: 0.2
  }}>
        <Icon icon="/snippets/assets/logos/Livepeer-Logo-Symbol-Theme.svg" />
      </span>
      <div style={{
    flex: 1,
    height: "1px",
    background: "var(--lp-color-border-default)",
    opacity: 0.4
  }}></div>
      {middleText && <>
          <Icon icon="circle" size={2} />
          <span style={{
    margin: "0 8px",
    fontWeight: "bold",
    color: color,
    opacity: 0.7
  }}>
            {middleText}
          </span>
          <Icon icon="circle" size={2} />
        </>}
      <div style={{
    flex: 1,
    height: "1px",
    background: "var(--lp-color-border-default)",
    opacity: 0.4
  }}></div>
      <span style={{
    marginLeft: "var(--lp-spacing-px-8)",
    opacity: 0.2
  }}>
        <span style={{
    display: "inline-block",
    transform: "scaleX(-1)"
  }}>
          <Icon icon="/snippets/assets/logos/Livepeer-Logo-Symbol-Theme.svg" />
        </span>
      </span>
    </div>;
};

<CenteredContainer preset="readable90">
  <Tip>Test your container under concurrent session load before registering on mainnet. GPU OOM under load is the most common production failure mode for BYOC containers.</Tip>
</CenteredContainer>

<CustomDivider />

A BYOC container that works locally may fail in production under concurrent sessions, GPU memory pressure, or ungraceful restarts. Use this checklist to verify container behaviour before registering on mainnet.

<CustomDivider />

## GPU memory profiling

Profile your container under the expected concurrent session count:

```bash theme={"theme":{"light":"github-light","dark":"dark-plus"}}
# Monitor GPU memory during load test
watch -n 1 nvidia-smi

# Run multiple concurrent sessions against local orchestrator
for i in $(seq 1 5); do
  curl -X POST http://localhost:8935/live-video-to-video -d '{"model_id":"my-model"}' &
done
```

Measure peak VRAM usage per session and multiply by expected concurrency. If peak exceeds your GPU's VRAM, either reduce per-session memory (smaller batch size, lower resolution) or limit the Orchestrator's `maxSessions` configuration.

<CustomDivider />

## Graceful shutdown

The Orchestrator sends `SIGTERM` when stopping a container. Handle it:

```python theme={"theme":{"light":"github-light","dark":"dark-plus"}}
import signal
import asyncio

async def shutdown(server):
    # Close active sessions
    await server.close_all_sessions()
    # Flush any buffered output
    await server.flush()

def handle_sigterm(signum, frame):
    asyncio.get_event_loop().create_task(shutdown(server))

signal.signal(signal.SIGTERM, handle_sigterm)
```

A container that does not handle `SIGTERM` is killed after a timeout (default 10 seconds). Active sessions receive no graceful close and may produce incomplete output.

<CustomDivider />

## Health check under load

The `/health` endpoint must return `{"status": "ok"}` even under full GPU load. If health checks fail, the Orchestrator stops advertising the capability and Gateways route elsewhere.

Common failure: the health check handler shares the GPU inference thread and blocks during heavy processing. Run health checks on a separate thread or async task.

<CustomDivider />

## Monitoring

Expose Prometheus metrics from your container for the Orchestrator's monitoring stack:

| Metric                  | Description                            |
| ----------------------- | -------------------------------------- |
| `byoc_sessions_active`  | Current concurrent sessions            |
| `byoc_frame_latency_ms` | Per-frame processing latency histogram |
| `byoc_gpu_memory_bytes` | Current GPU memory usage               |
| `byoc_errors_total`     | Processing errors by type              |

The Orchestrator's Prometheus scraper picks up metrics from containers on the same Docker network.

<CustomDivider />

The [BYOC architecture](/v2/developers/build/compute/byoc/byoc-architecture) covers the container interface. The [production checklist](/v2/developers/guides/production-hardening-checklist) covers Gateway-side production requirements.
