
September 10, 2026
13 min read
By Kokil Thapa | Last reviewed: September 2026
Production teams hit a wall when a single GPU can only serve a handful of concurrent chat users. vLLM: High-Throughput LLM Serving solves that bottleneck with memory-efficient KV-cache management and continuous batching. If you already run Ollama or vLLM locally, the jump to production is mostly about hardware, queueing, and observability—not rewriting your app. This guide covers how vLLM works, how to deploy it, and where it fits next to managed APIs and lighter local runners.
What is vLLM and why does it matter for high-throughput LLM serving?
vLLM is an open-source LLM inference and serving library from the vLLM project. It targets the gap between research notebooks and production APIs. Naive inference loads one request, runs a full forward pass, then frees memory. That pattern wastes GPU cycles when users type, think, or read streamed tokens.
vLLM instead keeps the model resident on GPU. It batches new tokens from many active sequences in one forward pass. Throughput rises because the GPU stays busy. Latency for individual users stays acceptable when batch sizes stay moderate and you cap max sequence length.
In my experience integrating LLM APIs into Laravel and WordPress products, the serving layer—not the prompt—often decides whether a feature survives launch week. A legal-tech portal with document Q&A can look fine in demos. Under twenty simultaneous users, a naive stack queues hard. vLLM is built for that second scenario.
Core features that drive throughput include:
- PagedAttention — KV cache stored in fixed-size blocks, like virtual memory pages
- Continuous batching — new requests join an in-flight batch without waiting for others to finish
- OpenAI-compatible REST API — swap base URLs in existing SDK clients
- Tensor parallelism and pipeline parallelism — scale one model across multiple GPUs
- Quantization support — AWQ, GPTQ, FP8, and related formats to fit larger models in VRAM
For background on latency versus throughput trade-offs, see serving LLMs in production. vLLM optimizes the throughput side without ignoring time-to-first-token.
How does PagedAttention enable higher throughput on limited GPU memory?
During autoregressive generation, each token adds key-value tensors to a growing KV cache. That cache often dominates VRAM use—not the model weights. Traditional serving pre-allocates one contiguous buffer per sequence sized to max_model_len. Most conversations never reach that cap. You pay for reserved memory you never touch.
PagedAttention splits the KV cache into blocks. A block table maps logical token positions to physical GPU blocks. When a sequence grows, vLLM allocates another block. When a sequence ends, blocks return to a free list. Fragmentation drops. More concurrent sessions fit on the same card.
Why this beats static allocation
Static allocation is simple to reason about. It also leaves 30–60% of KV memory idle on typical chat workloads. PagedAttention recovers that headroom. On a 24 GB GPU running a 7B model, the difference can be 8 versus 32 concurrent chats depending on context length and batch policy.
Continuous batching pairs with PagedAttention. At each decode step, the scheduler picks all sequences that need one more token. It builds a single batched forward pass. Finished sequences leave the batch. New ones enter during prefill. GPU utilization stays high across mixed-length conversations.
Long-context RAG workloads stress KV memory hardest. If your app sends 8K-token document chunks, read long-context LLM strategies before picking max_model_len. Oversizing that parameter wastes blocks even with paging.
How do you install and run vLLM for production serving?
vLLM runs on Linux with NVIDIA CUDA GPUs in most production setups. AMD ROCm builds exist for supported hardware. CPU-only mode is available for smoke tests—not for real throughput targets.
Basic OpenAI-compatible server
Install with pip in a dedicated virtual environment on Ubuntu 22 or 24:
python3 -m venv .venv
source .venv/bin/activate
pip install vllm
python -m vllm.entrypoints.openai.api_server \
--model meta-llama/Llama-3.1-8B-Instruct \
--host 0.0.0.0 \
--port 8000 \
--max-model-len 8192 \
--gpu-memory-utilization 0.90 Test with curl against the compatible chat endpoint:
curl http://127.0.0.1:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "meta-llama/Llama-3.1-8B-Instruct",
"messages": [{"role": "user", "content": "Summarize PagedAttention in one sentence."}],
"max_tokens": 128,
"stream": true
}' Point your OpenAI SDK at vLLM by changing the base URL and supplying any dummy API key if auth is disabled:
from openai import OpenAI
client = OpenAI(
base_url="http://gpu-server.internal:8000/v1",
api_key="not-needed"
)
response = client.chat.completions.create(
model="meta-llama/Llama-3.1-8B-Instruct",
messages=[{"role": "user", "content": "Hello"}],
stream=True,
)
for chunk in response:
print(chunk.choices[0].delta.content or "", end="") Streaming responses matter for perceived latency. Your PHP or Laravel front end should consume SSE or chunked JSON the same way it would with OpenAI. See streaming LLM responses with SSE for UI patterns that work behind reverse proxies.
Production hardening checklist
- Run vLLM behind Nginx or another reverse proxy with TLS termination and rate limits
- Set
--gpu-memory-utilizationbelow 1.0 to leave headroom for CUDA context spikes - Pin model revision and vLLM version in your deploy manifest—upgrades can change default kernels
- Export Prometheus metrics and log queue depth, prefill time, and decode tokens per second
- Configure health checks on
/healthor a lightweight completion probe - Use a process supervisor or container restart policy—GPU OOM kills the worker hard
For Kubernetes-native serving with autoscaling hooks, compare vLLM sidecars against KServe on Kubernetes. Many teams run vLLM in a single GPU VM first. They move to K8s only when replica count justifies the ops cost.
Server administration—firewall rules, GPU driver pins, nightly backups—belongs in the same runbook as your web tier. If you host in Nepal or on a budget VPS abroad, Linux system administration and hosting setup should be planned before you promise sub-second chat to stakeholders.
What GPU hardware and tuning knobs matter most for vLLM throughput?
VRAM sets the ceiling. Model weights, KV blocks, and activation buffers all compete for the same pool. A rough planning table helps before you rent cloud GPUs:
| Model class | Precision | Min VRAM (serve) | Typical cloud cost | Notes |
|---|---|---|---|---|
| 7B–8B instruct | FP16 | 16 GB | ~USD 0.50–1.50/hr | Good default for internal tools and RAG |
| 7B–8B instruct | AWQ / GPTQ 4-bit | 8–10 GB | ~USD 0.30–0.80/hr | Slight quality trade-off, big memory win |
| 13B–14B | FP16 | 28–32 GB | ~USD 1.50–3.00/hr | Stronger reasoning, fewer concurrent users |
| 70B | 4-bit + TP=2 | 2× 48 GB | ~USD 6–12/hr | Tensor parallel across two GPUs required |
Nepal-based teams often compare on-prem workstation GPUs against Singapore or Mumbai cloud regions. A local RTX 4090 at Rs 450,000 (~USD 3,400) can beat recurring cloud bills above Rs 40,000/month (~USD 300) if utilization stays high. Sporadic usage favors pay-per-hour rentals. Read self-hosting LLM options and GPU requirements for a fuller cost model.
Tuning parameters that move the needle
--max-num-seqs— caps concurrent sequences; raise until latency SLO breaks--max-model-len— lower this if RAG prompts are short; saves KV blocks--enable-prefix-caching— reuse KV for identical system prompts across users--tensor-parallel-size— split layers across GPUs for models that do not fit on one card--quantization awq— load pre-quantized weights when VRAM is tight
Prefix caching helps products with fixed system instructions—support bots, legal disclaimers, JSON schema reminders. It behaves like a hot cache for prompt prefixes. Application-level caching still matters for identical user queries. Combine both layers as described in caching strategies for high-traffic sites.
Monitor GPU memory with nvidia-smi dmon during load tests. Watch for PCIe bottlenecks when loading large checkpoints from disk. Store models on local NVMe, not network mounts.
How does vLLM compare to Ollama, TGI, and managed LLM APIs?
Pick the serving stack based on team size, traffic shape, and compliance—not GitHub stars alone.
| Criteria | vLLM | Ollama | Text Generation Inference | Managed API (OpenAI etc.) |
|---|---|---|---|---|
| Primary strength | Maximum GPU throughput | Developer convenience | Hugging Face ecosystem | Zero ops, latest models |
| OpenAI-compatible API | Yes, native | Partial / evolving | Yes | Yes (reference) |
| Multi-GPU scaling | Strong (TP / PP) | Limited | Strong | N/A (provider-side) |
| Setup complexity | Medium | Low | Medium–high | Lowest |
| Best fit | Production self-host at scale | Local dev and small deploys | HF model catalog shops | Fast MVP, variable traffic |
Ollama wins for laptop prototyping and single-user demos. vLLM wins when concurrent users and GPU dollars dominate. Managed APIs win when you lack GPU ops capacity or need frontier models immediately. Hybrid setups are common: vLLM for steady internal traffic, managed APIs for overflow or fallback.
Compare local runners in Ollama vs LM Studio and running LLMs locally with Ollama and vLLM. For API-only products, choosing an LLM API on cost, speed, and quality covers vendor selection.
How do you integrate vLLM into a Laravel or PHP application safely?
Most PHP stacks should treat vLLM as an HTTP dependency—not embed Python inside FPM workers. Queue long generations. Stream tokens to the browser. Never block an Apache or PHP-FPM child for thirty seconds waiting on GPU output.
A minimal Laravel service class wraps the OpenAI client pointed at vLLM:
<?php
namespace App\Services;
use OpenAI;
class VllmChatService
{
public function stream(string $prompt, callable $onDelta): void
{
$client = OpenAI::client(config('services.vllm.key'));
$stream = $client->chat()->createStreamed([
'model' => config('services.vllm.model'),
'messages' => [
['role' => 'system', 'content' => 'You are a concise assistant.'],
['role' => 'user', 'content' => $prompt],
],
'max_tokens' => 512,
]);
foreach ($stream as $response) {
$delta = $response->choices[0]->delta->content ?? '';
if ($delta !== '') {
$onDelta($delta);
}
}
}
} Dispatch heavy jobs to Laravel queues—the same pattern used for email and PDF generation on high-traffic apps. Read scaling Laravel queues for high traffic before you expose LLM endpoints on synchronous routes.
Security and compliance checkpoints:
- Strip PII before prompts leave your app; see protecting PII in LLM apps
- Validate tool-call outputs server-side when using function calling with LLMs
- Apply retries and circuit breakers; handle rate limits and retries even on self-hosted endpoints
- Log prompt hashes, latency, and token counts—not full user text—in production
For structured JSON from models, enforce schemas in PHP after generation. Pair with structured outputs from LLMs and validate payloads with the JSON formatter tool during development.
On a legal-tech portal I built, document summarization ran behind a queue with per-firm rate limits. vLLM sat on a private subnet. The public Laravel app never held GPU credentials. That separation simplified audits and firewall rules.
Full product delivery—RAG pipelines, admin dashboards, billing—maps to AI integration and automation services and API development. Reference implementations appear in client portal projects where secure document workflows matter.
What operational practices keep vLLM reliable under load?
Throughput without observability is a demo, not a service. Treat vLLM like any stateful backend: define SLOs, load-test before marketing launches, and run game days for GPU node failure.
Metrics worth dashboarding
- Time to first token (TTFT) at p50 and p95
- Tokens per second per request and aggregate GPU throughput
- Queue wait time before prefill starts
- GPU memory used versus
gpu-memory-utilizationcap - HTTP 5xx rate and OOM restart count
Wire alerts into the same channel as database slow-query alerts. LLM regressions show up as rising TTFT long before users complain. LLMOps monitoring and guardrails and shipping LLM apps with LLMOps cover evaluation loops that complement raw metrics.
Load testing should mimic real chat—not uniform random prompts. Mix short questions, 4K RAG contexts, and occasional tool-call rounds. Tools like vllm bench serve (bundled with the project) give baseline numbers. Your app-level test must include PHP queue delay and Redis contention.
Cost control still applies on owned GPUs. Track tokens per customer for billing or quota enforcement. LLM cost optimization translates cleanly to "GPU hours per thousand requests" when you self-host.
Privacy-sensitive workloads—Nepali health, legal, or financial data—often mandate on-prem inference. Pair vLLM with local LLMs for privacy-sensitive apps policy patterns: network isolation, no outbound telemetry, encrypted volumes.
Official references: the vLLM documentation covers CLI flags and supported models, and the vLLM GitHub repository tracks release notes. For the original PagedAttention paper and benchmarks, see the PagedAttention research preprint on arXiv.
Key Takeaways
- vLLM: High-Throughput LLM Serving wins on concurrent GPU utilization via PagedAttention and continuous batching—not raw model quality.
- Start with the OpenAI-compatible API server; point existing SDKs at your GPU host with a base URL change.
- Right-size
max-model-lenand enable prefix caching before buying a second GPU. - Never run long vLLM calls inside PHP-FPM workers—queue, stream, and rate-limit at the app layer.
- Compare self-hosted vLLM against managed APIs using total cost at your actual queries-per-minute, not sticker hourly rates.
- Monitor TTFT, queue depth, and OOM restarts from day one; throughput dies silently when KV memory fills.
People Also Ask
Is vLLM faster than Ollama for production traffic?
Yes, for concurrent users on the same GPU. Ollama optimizes developer experience and single-session latency. vLLM optimizes batch throughput with PagedAttention. For a production API serving dozens of simultaneous chats, vLLM typically delivers several times higher tokens per second per dollar.
Does vLLM support streaming and function calling?
vLLM's OpenAI-compatible server supports streaming chat completions. Tool and function calling support depends on model and server version—verify against the model card and current vLLM release notes before relying on it in production agent workflows.
Can you run vLLM without an NVIDIA GPU?
NVIDIA CUDA GPUs are the primary production path. AMD ROCm builds exist for supported cards. CPU backends work for functional testing but do not meet high-throughput LLM serving goals for real user load.
How many users can one vLLM GPU handle?
There is no fixed number. A 24 GB GPU running an 8B model might serve 20–40 short chats or far fewer long RAG sessions. Load test with your prompt length, max-model-len, and latency SLO—the only honest answer for your app.
Ship high-throughput LLM features with the right serving layer
vLLM: High-Throughput LLM Serving is the practical choice when self-hosted inference must carry real concurrent load without multiplying GPU spend. Start from the OpenAI-compatible server, tune memory and sequence limits against your RAG prompts, and keep Laravel or PHP apps thin with queues and streaming. When you need help sizing hardware, wiring private GPU endpoints, or integrating summarization into a production portal, contact us or explore custom software development. For related reading, browse more LLM and infrastructure guides or review production portals where secure workflows come first.
Frequently Asked Questions
0 Comments
Leave a comment
Your email is not published. Comments appear once they have been read. Sign in to have your details filled in.

