Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions serverless/load-balancing/overview.mdx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---

Check warning on line 1 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L1

Try to keep the Gunning-Fog index (11.52) below 10.

Check warning on line 1 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L1

Try to keep the Flesch–Kincaid grade level (11.26) below 8.

Check warning on line 1 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L1

Try to keep the SMOG grade (12.73) below 10.

Check warning on line 1 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L1

Try to keep the Flesch reading ease score (41.62) above 70.

Check warning on line 1 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L1

Try to keep the LIX score (49.27) below 35.

Check warning on line 1 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L1

Try to keep the Automated Readability Index (11.56) below 8.

Check warning on line 1 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L1

Try to keep the Coleman–Liau Index grade (13.89) below 9.
title: "Overview"
sidebarTitle: "Overview"
description: "Deploy custom direct-access REST APIs with load balancing Serverless endpoints. Review configuration and operations guidance for Runpod Serverless."

Check warning on line 4 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L4

Spell out 'REST', if it's unfamiliar to the audience.
---

import { RequestsTooltip, QueueBasedEndpointsTooltip } from "/snippets/tooltips.jsx";

Load balancing endpoints route incoming traffic directly to available workers, bypassing the queueing system. Unlike <QueueBasedEndpointsTooltip /> that process requests sequentially, load balancing distributes requests across your worker pool for lower latency.

You can create custom REST endpoints accessible via a unique URL:

Check warning on line 11 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L11

Spell out 'REST', if it's unfamiliar to the audience.

```
https://ENDPOINT_ID.api.runpod.ai/YOUR_CUSTOM_PATH
Expand All @@ -28,15 +28,15 @@

### Queue-based endpoints

With queue-based endpoints, <RequestsTooltip /> are placed in a queue and processed in order. They use the standard handler pattern (`def handler(job)`) and are accessed through fixed endpoints like `/run` and `/runsync`.

Check warning on line 31 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L31

Use parentheses judiciously.

Check warning on line 31 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L31

In general, use active voice instead of passive voice ('are placed').

Check warning on line 31 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L31

In general, use active voice instead of passive voice ('are accessed').

These endpoints are better for tasks that can be processed asynchronously and guarantee request processing, similar to how TCP guarantees packet delivery in networking.

Check warning on line 33 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L33

In general, use active voice instead of passive voice ('be processed').

Check warning on line 33 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L33

Avoid the unverifiable claim 'guarantee'.

Check warning on line 33 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L33

Avoid the unverifiable claim 'guarantees'.

### Load balancing endpoints (new)

Check warning on line 35 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L35

Use parentheses judiciously.

Load balancing endpoints send requests directly to workers without queuing. You can use any HTTP framework such as FastAPI or Flask, and define custom URL paths and API contracts to suit your specific needs.

These endpoints are ideal for real-time applications and streaming, but provide no queuing mechanism for request backlog, similar to UDP's behavior in networking.

Check warning on line 39 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L39

Spell out 'UDP', if it's unfamiliar to the audience.


## Endpoint type comparison table
Expand All @@ -44,15 +44,15 @@
Aspect | Load balancing | Queue-based |
|--------|----------------|-------------|
| **Request flow** | Direct to worker HTTP server | Through queueing system |
| **Implementation** | Custom HTTP server (FastAPI, Flask, etc.) | Handler function |

Check warning on line 47 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L47

Use parentheses judiciously.
| **API flexibility** | Custom URL paths, any HTTP capability | Fixed `/run` and `/runsync` endpoints |
| **Backpressure** | Drops requests when overloaded | Queue buffering |
| **Latency** | Lower (single-hop) | Higher (queue + worker) |

Check warning on line 50 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L50

Use parentheses judiciously.

Check warning on line 50 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L50

Use parentheses judiciously.
| **Error handling** | No built-in retry | Automatic retries |

## Worker comparison

**Queue-based worker** (traditional):

Check warning on line 55 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L55

Use parentheses judiciously.

```python
import runpod
Expand All @@ -64,7 +64,7 @@
runpod.serverless.start({"handler": handler})
```

**Load balancing worker** (custom HTTP server):

Check warning on line 67 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L67

Use parentheses judiciously.

```python
from fastapi import FastAPI
Expand Down Expand Up @@ -116,19 +116,19 @@

| Variable | Default | Description |
|----------|---------|-------------|
| `PORT` | `80` | Main application server port |

Check warning on line 119 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L119

Use 'app' instead of 'application'.
| `PORT_HEALTH` | Same as `PORT` | Health check endpoint port |
| `HEALTH_CHECK_PATH` | `/ping` | Path the load balancer polls to check worker health |

If using a custom port, add it to your endpoint's environment variables and expose it in container configuration (under **Expose HTTP Ports (Max 10)**).

Check warning on line 123 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L123

Use parentheses judiciously.

## Timeouts and limits

| Limit | Value |
|-------|-------|
| **Request timeout** | 2 min (no worker available) |

Check warning on line 129 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L129

Use parentheses judiciously.
| **Processing timeout** | 5.5 min (per request) |

Check warning on line 130 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L130

Use parentheses judiciously.
| **Payload limit** | 30 MB (request and response) |

Check warning on line 131 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L131

Use parentheses judiciously.

For payloads larger than 30 MB, use [network volumes](/storage/network-volumes) or implement chunking.

Expand Down Expand Up @@ -166,13 +166,26 @@

Use at least 3 retries with 5-10 second delays.

## When to use queue-based endpoints

Use queue-based endpoints when you need:

- Job-based or long-running workloads that run for extended periods. Load balancing is not suited for long-running tasks and would time out or drop the request.

Check warning on line 173 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L173

Use 'isn't' instead of 'is not'.
- Guaranteed execution where every request is queued and processed, even during traffic spikes. No requests are dropped when workers are busy.

Check warning on line 174 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L174

In general, use active voice instead of passive voice ('is queued').

Check warning on line 174 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L174

In general, use active voice instead of passive voice ('are dropped').
- Batch or offline workloads processed asynchronously where latency is not critical, such as nightly dataset processing, pre-computing embeddings, or running evaluations.

Check warning on line 175 in serverless/load-balancing/overview.mdx

View check run for this annotation

Mintlify / Mintlify Validation (runpod-b18f5ded) - vale-spellcheck

serverless/load-balancing/overview.mdx#L175

Use 'isn't' instead of 'is not'.
- Automatic retries on failure without any client-side logic.
- Configurable concurrency that supports both low and high concurrency workloads depending on your needs.

Choose queue-based when your workload can tolerate higher latency in exchange for reliability and guaranteed delivery. If your use case is a short, real-time request/response transaction, use a load balancing endpoint instead.

## When to use load balancing endpoints

Use load balancing endpoints when you need:

- Direct access to your model's HTTP server.
- Internal batching systems (like vLLM).
- Non-JSON payloads.
- Multiple endpoints within a single worker.
- Lower latency for real-time applications.
- Direct access to your model's HTTP server without queueing overhead.
- Internal batching systems like vLLM that manage their own request batching internally.
- Non-JSON payloads such as binary data or multipart uploads.
- Multiple endpoints within a single worker using custom URL paths and any HTTP framework.
- Low-latency real-time applications where responses are immediate and ephemeral, such as serving a file download or returning page stats.

Choose load balancing when your workload is latency-sensitive and responses are immediate. If your use case involves long-running jobs or requires guaranteed delivery, use a queue-based endpoint instead.
Loading