Streaming response ในปี 2026: SSE vs WebSockets vs gRPC สำหรับ AI app¶
AI app ทุกตัวต้อง stream แต่ทีมส่วนใหญ่เลือก transport ผิด แล้วนั่ง debug กันทั้งอาทิตย์ว่าทำไม token แรกโผล่มาหลัง 8 วินาที LLM เร็วอยู่แล้ว ที่ช้าคือ network ที่ขวางอยู่ข้างหน้า โพสต์นี้เทียบ transport สามตัวที่ใช้บน production ได้จริง (SSE, WebSockets, gRPC streaming) ชี้กับดัก buffering ที่ทำให้ streaming พัง แล้วปิดท้ายด้วย decision framework ที่ช่วยให้คุณเลือกได้ใน 30 วินาที
ถ้าคุณเคยทำ streaming endpoint แบบ "ChatGPT-style" ที่บน dev ทำงานดี แต่พอขึ้น staging หลัง nginx กลับพัง โพสต์นี้เขียนมาให้คุณ
Transport สามตัวที่ต้องรู้¶
AI streaming ในปี 2026 มี transport ให้พิจารณาแค่สามตัว ที่เหลือเป็นแค่ wrapper ที่ครอบหนึ่งในสามตัวนี้อีกชั้น
| Transport | ทิศทาง | เหมาะกับ | มาตรฐาน |
|---|---|---|---|
| Server-Sent Events (SSE) | Server → Client (ทางเดียว) | Chat response, completion, agent trace | W3C ตั้งแต่ 2015 |
| WebSockets | สองทาง แบบ full-duplex | Realtime collaboration, voice, multi-turn ที่มี tool call | RFC 6455 |
| gRPC streaming | Server, client หรือ bidi | Microservice คุยกับ microservice, pipeline ภายใน, งาน high-throughput | gRPC spec |
ถ้า stream จาก browser ไปหา user เริ่มที่ SSE ถ้าต้องการ realtime สองทาง ใช้ WebSockets ถ้าส่ง token ระหว่าง service ภายใน cluster ใช้ gRPC streaming
ส่วนที่เหลือของโพสต์คือ gotcha บน production ที่แต่ละตัวต้องเจอ
1. Server-Sent Events (SSE) — ตัวเลือกแรกของ AI app¶
SSE ก็คือ HTTP ที่ตอบกลับด้วย Content-Type: text/event-stream แล้วเปิด connection ค้างไว้ จากนั้น server ก็เขียนบรรทัด data: <chunk>\n\n ออกไปเรื่อย ๆ แค่นั้นเอง ฝั่ง browser ใช้ EventSource API อ่านได้เลย ไม่ต้องลงอะไรเพิ่ม
ทำไม AI app ส่วนใหญ่ควรใช้ SSE:
- เป็น HTTP ธรรมดา ผ่านได้ทุก CDN ทุก reverse proxy ทุกระบบ auth
- Browser API มี auto-reconnect ให้ในตัว
- ไม่ต้องทำ protocol upgrade handshake (WebSockets ต้องทำ)
- ทำงานร่วมกับ HTTP/2 multiplexing ได้ดี
- Debug ง่าย แค่
curlหรือเปิด browser DevTools ก็เห็นแล้ว - ใช้ bearer token, cookie และ CSRF protection ได้เหมือน HTTP endpoint ทั่วไปทุกอย่าง
ฝั่ง server ใช้ framework ไหนก็ได้ ตัวอย่างนี้ใช้ Node.js (Hono 4.12.x) ส่งต่อ stream จาก vLLM:
// server.ts — Hono 4.12.x
import { Hono } from "hono"
import { stream } from "hono/streaming"
const app = new Hono()
app.post("/v1/chat", async (c) => {
const body = await c.req.json()
c.header("Content-Type", "text/event-stream")
c.header("Cache-Control", "no-cache")
return stream(c, async (s) => {
// Pipe vLLM's OpenAI-compatible stream straight through
const upstream = await fetch("http://vllm:8000/v1/chat/completions", {
method: "POST",
headers: { "Content-Type": "application/json", Authorization: `Bearer ${env.VLLM_KEY}` },
body: JSON.stringify({ ...body, stream: true }),
})
const reader = upstream.body!.getReader()
const decoder = new TextDecoder()
while (true) {
const { done, value } = await reader.read()
if (done) break
// Forward bytes as-is — they're already SSE-formatted
await s.write(decoder.decode(value, { stream: true }))
}
})
})
ฝั่ง client ใช้ browser ล้วน ๆ:
// EventSource is GET-only — this assumes a GET /v1/chat route,
// not the POST handler above. For POST bodies, see the fetch parser below.
const evtSource = new EventSource("/v1/chat?msg=hello")
evtSource.onmessage = (e) => {
if (e.data === "[DONE]") { evtSource.close(); return } // not valid JSON — guard first
const chunk = JSON.parse(e.data)
appendToUI(chunk.choices[0]?.delta?.content || "")
}
evtSource.onerror = () => {
// EventSource auto-reconnects; UI state is preserved
console.log("stream interrupted, reconnecting…")
}
ถ้าต้องใช้ POST (request body ใหญ่เกินจะใส่ใน query param) EventSource ช่วยไม่ได้ ต้องใช้ fetch API แล้วเขียน SSE parser เอง:
// For POST bodies, the browser fetch API is the right tool
const response = await fetch("/v1/chat", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ messages }),
})
const reader = response.body!.getReader()
const decoder = new TextDecoder()
let buffer = ""
while (true) {
const { done, value } = await reader.read()
if (done) break
buffer += decoder.decode(value, { stream: true })
// Split on SSE event boundary (\n\n), emit complete events
const events = buffer.split("\n\n")
buffer = events.pop() || "" // keep partial event in buffer
for (const evt of events) {
const line = evt.split("\n").find(l => l.startsWith("data: "))
if (!line) continue
const data = line.slice(6)
if (data === "[DONE]") continue
const chunk = JSON.parse(data)
appendToUI(chunk.choices[0]?.delta?.content || "")
}
}
SSE มีข้อจำกัดอยู่ข้อเดียว: ส่งได้ทางเดียว client ส่งข้อมูลกลับผ่าน connection เดิมไม่ได้ ถ้า AI app ต้องคุยสองทาง เช่น multi-turn ที่ client เป็นคนตัดสินใจเรื่อง tool call, realtime voice หรือ collaborative editing ก็ต้องไปใช้ WebSockets
2. WebSockets — คุยได้สองทางแบบ realtime แต่ infra เยอะกว่า¶
WebSockets ให้ connection แบบ full-duplex บน TCP socket เดียว client กับ server ส่ง message หากันได้ทุกเมื่อ พอผ่าน HTTP upgrade ครั้งแรกไปแล้ว protocol จะเปลี่ยนไปส่งเป็น binary frame
AI app แบบไหนเหมาะกับ WebSockets:
- บทสนทนา multi-turn ที่ client ส่งผลจาก tool กลับมาระหว่าง stream
- Realtime voice (browser MediaRecorder → STT → LLM → TTS ที่หลาย stream วิ่งซ้อนกัน)
- Collaborative editing (user หลายคน ใช้ LLM ตัวเดียว แชร์ state ร่วมกัน)
- งานไหนก็ตามที่ LLM ต้อง push control message ("กำลังจะเรียก tool ตัวนี้นะ") แล้วต้องรอรับ response กลับมาด้วย
ฝั่ง server ใช้ ws 8.21.x บน Node.js:
// server.ts — ws 8.21.x
import { WebSocketServer } from "ws"
const wss = new WebSocketServer({ port: 8080 })
wss.on("connection", async (ws) => {
ws.on("message", async (raw) => {
const { type, payload } = JSON.parse(raw.toString())
if (type === "user_message") {
// Stream from vLLM and forward each token as a WebSocket frame
try {
const upstream = await fetch("http://vllm:8000/v1/chat/completions", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ ...payload, stream: true }),
})
if (!upstream.ok || !upstream.body) {
throw new Error(`upstream returned ${upstream.status}`)
}
const reader = upstream.body.getReader()
const decoder = new TextDecoder()
while (true) {
const { done, value } = await reader.read()
if (done) break
const text = decoder.decode(value, { stream: true })
// Parse SSE events from upstream, send each as a WS frame
for (const line of text.split("\n")) {
if (line.startsWith("data: ") && line !== "data: [DONE]") {
ws.send(JSON.stringify({ type: "token", data: JSON.parse(line.slice(6)) }))
}
}
}
ws.send(JSON.stringify({ type: "done" }))
} catch (err) {
// Don't let upstream failures silently kill the WS — surface to client
ws.send(JSON.stringify({ type: "error", message: (err as Error).message }))
} finally {
// Close so the client knows the stream is over; without this the WS
// sits idle until ALB/nginx (60s) or Cloudflare (100s) kills it.
ws.close()
}
}
})
})
ฝั่ง client:
const ws = new WebSocket("wss://api.example.com/v1/chat")
ws.onopen = () => {
ws.send(JSON.stringify({ type: "user_message", payload: { messages } }))
}
ws.onmessage = (e) => {
const msg = JSON.parse(e.data)
if (msg.type === "token") appendToUI(msg.data.choices[0]?.delta?.content || "")
if (msg.type === "done") markComplete()
}
Gotcha ด้าน infra ที่ WebSockets มักเจอบน production:
- Auth: บาง browser ส่ง cookie ผ่าน upgrade ได้ไม่เรียบร้อย จะใส่ bearer token ใน URL ก็ได้ แต่ token จะไปโผล่ใน access log ทางที่ดีคือออก token อายุสั้นผ่าน POST ก่อน แล้วค่อย upgrade
- Sticky session: ถ้ามี WebSocket server หลายตัวอยู่หลัง load balancer client ต้องวิ่งไปหา server ตัวเดิมตลอดอายุ connection ALB ทำได้ด้วย sticky cookie ส่วน nginx ต้องใช้
ip_hashหรือ session cookie - Idle timeout: ALB ตั้ง idle timeout ไว้ 60s, nginx default 60s, Cloudflare 100s connection ไหนเงียบนานเกินนี้โดนตัดทิ้ง ส่ง ping ทุก 30s (
ws.ping()) ไว้กันหลุด - ไม่มี HTTP/2 multiplexing: WebSocket หนึ่งตัวกิน TCP connection หนึ่งเส้น user พร้อมกัน 10K คนก็เท่ากับ 10K socket ส่วน SSE ได้ HTTP/2 multiplexing มาฟรี
หลักง่าย ๆ: ต้องคุยสองทางใช้ WebSockets ถ้าแค่ server ส่งไปหา client ใช้ SSE กับดักด้าน infra น้อยกว่าเยอะ
3. gRPC streaming — ตัวเลือกสำหรับใช้ภายใน cluster¶
gRPC streaming ใช้ตอนที่ token วิ่งระหว่าง service ไม่ใช่จาก server ไปหา browser BFF คุยกับ agent service ผ่าน gRPC แล้ว agent service ก็คุยกับ model service ผ่าน gRPC อีกต่อ ส่วน model service รับ stream มาจาก vLLM
มีสามแบบ: - Server-streaming: client ส่ง request ไปครั้งเดียว server stream response กลับมาหลายก้อน - Client-streaming: client stream request ไปหลายก้อน server ตอบกลับครั้งเดียว - Bidirectional: stream ทั้งสองฝั่ง
ถ้าจะ stream token จาก LLM ให้ใช้แบบ server-streaming
Proto:
// chat.proto
syntax = "proto3";
service Chat {
rpc Complete(CompleteRequest) returns (stream CompleteResponse);
}
message CompleteRequest {
repeated ChatMessage messages = 1;
string model = 2;
float temperature = 3;
int32 max_tokens = 4;
}
message CompleteResponse {
string delta = 1;
string finish_reason = 2;
Usage usage = 3;
}
message Usage {
int32 prompt_tokens = 1;
int32 completion_tokens = 2;
}
message ChatMessage {
string role = 1;
string content = 2;
}
Server (Go):
// server.go
func (s *chatServer) Complete(req *pb.CompleteRequest, stream pb.Chat_CompleteServer) error {
upstream, _ := vllm.StreamComplete(ctx, req.Messages, req.Model)
for token := range upstream.Tokens {
if err := stream.Send(&pb.CompleteResponse{Delta: token}); err != nil {
return err
}
}
return stream.Send(&pb.CompleteResponse{FinishReason: "stop"})
}
Client (Go):
stream, _ := client.Complete(ctx, &req)
for {
resp, err := stream.Recv()
if err == io.EOF { break }
if err != nil { log.Fatal(err) }
fmt.Print(resp.Delta)
}
ทำไม gRPC เหมาะกับงาน service-to-service:
- ได้ HTTP/2 multiplexing มาฟรี — connection เดียว วิ่งได้หลาย stream พร้อมกัน
- Schema-first (ไฟล์ proto) — generate typed client ได้ทุกภาษาที่ support อย่างเป็นทางการ (Go, Java, Python, C++, C#, Node, Rust ผ่าน tonic และอีกหลายภาษา)
- มี deadline, cancellation, retry ในตัว — user ปิดแท็บเมื่อไหร่ client ก็ยกเลิก stream ได้ทันที
- Backpressure — gRPC รู้ตัวว่า consumer รับไม่ทัน แล้วใช้ flow control ชะลอให้
- mTLS และ auth — เรื่อง security gRPC จัดการได้ดี
ทำไม gRPC ไม่เหมาะกับ browser-to-server:
Browser คุย gRPC ตรง ๆ ไม่ได้ ต้องใช้ grpc-web และมี proxy (Envoy) คั่นกลางคอยแปล เท่ากับเพิ่ม hop อีกชั้น เพิ่มจุดที่จะพังอีกจุด แล้ว debug ก็ยากขึ้น ฝั่ง browser edge ใช้ SSE หรือ WebSockets ดีกว่า
แบ่งแบบนี้ลงตัวที่สุดในปี 2026:
กับดัก buffering — สาเหตุอันดับ 1 ที่ streaming "ไม่ทำงาน"¶
LLM ส่ง token แรกกลับมาใน 80ms แต่ user เห็นจริงตอน 8 วินาที ตัวที่ช้าไม่ใช่ LLM แต่เป็น proxy ที่คั่นอยู่ตรงกลาง แต่ละตัวมี buffering policy เป็นของตัวเอง
nginx buffering (เปิดไว้เป็น default ทุกเวอร์ชัน ต้องปิดเอง):1
# CRITICAL: disable proxy buffering for SSE
location /v1/chat {
proxy_pass http://bff;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_buffering off; # default is ON — that default is what breaks SSE
proxy_cache off;
}
อีกทางคือไม่ต้องแตะ nginx เลย ให้ BFF ส่ง X-Accel-Buffering: no มาเป็น response header พอ nginx เห็นก็จะปิด buffering ให้เฉพาะ response นั้น (header ตัวนี้ backend เป็นคนส่งกลับมา ไม่ใช่ proxy_set_header ที่ส่งขึ้นไป upstream)
Cloudflare buffering (free tier buffer หนักมาก):2
- Free plan: โดน buffer (streaming พังหรือมาช้า)
- Pro plan: ทำตาม
X-Accel-Buffering: no - ปิด buffering ทีละ response ได้ด้วย transform rule
no-buffer
AWS ALB:3
- ALB ส่ง streaming response ผ่านได้ปกติ ปัญหาอยู่ที่ idle timeout (default 60s ตั้งได้สูงสุด 4000s) connection ไหนเงียบนานเท่านั้น ALB ตัดทิ้ง ถ้า token มาห่างกันหรือ agent หยุดรออะไรสักอย่าง stream ก็หลุด
- วิธีแก้: ส่ง keepalive comment (
: ping\n\n) ช่วงที่เงียบ, ขยาย idle timeout หรือเอา NLB มาวางข้างหน้าสำหรับ TCP connection อายุยาวที่ไม่มี L7 idle timeout
http.ResponseWriter ของ Go:
// Default behavior BUFFERS. Must flush after each write.
// http.ResponseController (Go 1.20+) works even when middleware wraps w,
// unlike a raw w.(http.Flusher) assertion, which silently no-ops on a wrapped writer.
rc := http.NewResponseController(w)
for token := range tokens {
fmt.Fprintf(w, "data: %s\n\n", token)
rc.Flush() // <-- without this, the client waits
}
Mental model: proxy ทุกตัวระหว่าง LLM กับ user มี buffer ที่คิดว่า "รอก่อน เดี๋ยวอาจมีมาอีก" แต่ละตัวเพิ่ม perceived latency อีก 100-500ms ผ่าน proxy ห้าตัว byte แรกก็ไปถึง user ช้าไป 2-3 วินาทีแล้ว ปิด buffering ให้หมดทุก hop
Time-to-first-token vs inter-token latency — ต้องวัดทั้งคู่¶
AI app มีสอง metric ที่ต้องดู และต้อง track แยกกัน
Time to First Token (TTFT) — นับจากส่ง request จนได้ token แรก เป้า: < 500ms สำหรับ chat ถ้าเป็น long-context ไม่เกิน 2s ก็รับได้
Inter-Token Latency (ITL) — เวลาเฉลี่ยระหว่าง token แต่ละตัวที่ตามมา เป้า: < 50ms (ลื่น), < 100ms พอรับได้, > 150ms เริ่มกระตุก
โมเดล 70B บน H100 ใบเดียวได้ TTFT ≈ 200ms, ITL ≈ 25ms4 ส่วนโมเดล 400B บน H100 4 ใบที่ต่อกันด้วย NVLink ได้ TTFT ≈ 400ms (ต้องรอ GPU ตัวที่ช้าสุด) และ ITL ≈ 35ms (ตัวที่ถ่วงคือโมเดลเอง ไม่ใช่ interconnect)
TTFT แย่ มักเกิดจาก:
| สาเหตุ | อาการ | วิธีแก้ |
|---|---|---|
| KV cache ยังเย็น (บทสนทนาใหม่) | Request แรกช้า หลังจากนั้นเร็ว | Warm pool ไว้ 2 replica |
| Preprocessing (RAG retrieval, ประกอบ prompt) | ช้าตั้งแต่ก่อนเรียก LLM | ทำ parallel, ใส่ cache |
| Backend ช้า (vLLM self-hosted ที่ resource ไม่พอ) | ช้าตลอด | เพิ่ม GPU |
| Proxy buffering | Byte แรกมาช้า 2-8s จากนั้นเร็ว | ปิด buffering ทุกจุด |
| Network RTT ไปหา provider | TTFT เพิ่ม 100-300ms | เลือก provider ใน region ใกล้ ๆ หรือ self-host |
ITL แย่ มักเกิดจาก:
| สาเหตุ | อาการ | วิธีแก้ |
|---|---|---|
| โมเดลใหญ่เกิน GPU | ช้าทุก token | Quantize (Q4) หรือ scale TP |
| Context window ยาวเกินไป | ยิ่งท้าย token ยิ่งช้า | Truncate, summarize หรือใช้ sliding window |
Request พร้อมกันเกิน --max-num-seqs | Request ใหม่ต้องเข้าคิว แต่ ITL นิ่ง | Scale out หรือลด concurrent ลง |
| Network round-trip ทุก token | แย่ลงบน mobile/Wi-Fi | ใช้ HTTP/2 + chunked แทน WebSocket-per-frame |
Instrument ทั้งคู่ ส่งทั้งสอง metric เข้า Prometheus และ Langfuse ตั้ง alert ไว้ที่ TTFT p95 > 1s และ ITL p95 > 100ms ถ้าไม่มี alert พวกนี้ คุณจะรู้ปัญหาจาก user ก่อน dashboard
Decision framework — เลือกให้ได้ใน 30 วินาที¶
| สถานการณ์ | เลือก | เหตุผล |
|---|---|---|
| Browser → server, server push token ไปหา user | SSE | ง่ายสุด เป็น HTTP อยู่แล้ว ใช้ได้ทุกที่ |
| Browser ต้องส่งผลจาก tool กลับมากลาง stream หรือต้องคุยสองทาง | WebSockets | ทางเดียวที่ browser คุย bidi ได้จริง |
| Service-to-service ภายใน cluster | gRPC streaming | Multiplexing, backpressure, schema |
| Browser → server แต่ต้องใช้ HTTP/2 multiplexing กับ user จำนวนมาก | SSE (HTTP/2 multiplex ให้ฟรี) | TCP connection เดียว วิ่งได้หลาย stream |
| Mobile app ที่ network ไม่นิ่ง | SSE พร้อม reconnection backoff | มี auto-reconnect ในตัว ส่วน WebSockets หลุดง่ายบนมือถือ |
| Voice / audio streaming | WebSockets | Audio frame ต้องวิ่งสองทาง และต้องการ latency ต่ำ |
| Pipeline ภายใน, high throughput (stream พร้อมกันหลักพัน) | gRPC streaming | HTTP/2 + flow control + connection reuse |
เริ่มที่ SSE แล้วค่อยเพิ่ม WebSockets เมื่อ SSE ทำสิ่งที่ต้องการไม่ได้จริง ๆ ส่วน gRPC เก็บไว้ใช้ระหว่าง service ภายใน cluster เท่านั้น
Checklist ก่อน deploy¶
ก่อนปล่อย AI streaming endpoint ขึ้นจริง เช็กให้ครบ:
- ปิด buffering ครบทุก proxy — nginx, Cloudflare, ALB และ BFF framework ที่ใช้
- Instrument TTFT และ ITL แล้ว — Prometheus + Langfuse มี dashboard p50/p95/p99
- ตั้ง alert ที่ TTFT p95 > 1s และ ITL p95 > 100ms
- Client รับมือ reconnection ได้ — SSE ใช้
EventSource, WebSockets ทำ ping/pong เอง - ทดสอบ backpressure แล้ว — client ที่ช้าต้องไม่ยึด worker ค้างไว้ และ client disconnect เมื่อไหร่ต้องยกเลิก upstream ด้วย
- Auth ใช้ได้ตลอด stream — SSE/gRPC ใส่ bearer ใน header ส่วน WebSocket upgrade ใช้ token อายุสั้น
- มีงบเวลาสำหรับ token แรก — วัดแบบ end-to-end ไม่ใช่ดูแค่ TTFT ของ LLM
- Idle keepalive — WebSocket ping ทุก 30s และตั้ง gRPC
keepalive_timeไว้ - ทดสอบบนมือถือแล้ว — SSE ต้อง reconnect ได้เนียนตอนสลับ network (WiFi → LTE)
- ใส่ Vary ตาม
Acceptถ้าเสิร์ฟทั้ง SSE และ JSON จาก path เดียวกัน
Summary¶
- เริ่มที่ SSE สำหรับ streaming จาก browser ไป server เป็น HTTP ธรรมดา ใช้ได้เลย
- ใช้ WebSockets เมื่อต้องคุยสองทาง (tool call กลาง stream, voice, collab)
- ใช้ gRPC streaming สำหรับ service-to-service ภายใน cluster
- ปิด buffering ทุก proxy — LLM ไม่ได้ช้า ที่ช้าคือ proxy
- วัด TTFT และ ITL แยกกัน — สองตัวนี้พังคนละแบบ
- เลือก transport แล้วเปลี่ยนยาก — คิดให้ดีตั้งแต่แรก เพราะเปลี่ยนทีหลังแพง
LLM เป็นส่วนที่ง่าย AI app จะรอดหรือพังขึ้นอยู่กับ transport
เวอร์ชันที่อ้างถึง¶
- Hono
4.12.x— เช็กแล้วเป็น 4.12.25 บน npm, มิถุนายน 2026 - ws
8.21.x— เช็กแล้วเป็น 8.21.0 บน npm, มิถุนายน 2026 - Go
net/http—http.ResponseControllerต้องใช้ Go1.20+(Go 1.20 release notes) ตอนนี้ stable อยู่ที่go1.26.4 - nginx directive
proxy_buffering— default เป็นonทุกเวอร์ชัน เช็กกับเอกสาร nginx ปัจจุบันแล้ว - AWS ALB — idle timeout default 60s สูงสุด 4000s เช็กกับ AWS ALB user guide แล้ว
- Cloudflare — พฤติกรรม streaming/range เช็กกับหน้า
default-cache-behaviorปัจจุบัน ส่วนหน้าstreaming/ที่เคยแยกไว้ Cloudflare เอาออกไปแล้ว เรื่อง free plan โดน throttle เป็นแค่ตัวอย่างประกอบ ควรลองกับ traffic จริงของคุณเอง
มีคำถามหรืออยากคุยต่อ? ติดต่อได้ทาง LinkedIn, X หรือส่ง email
-
nginx, Proxy Module —
proxy_bufferingdirective default เป็นonทุกเวอร์ชัน ถ้าอยากให้ SSE flush ได้ ต้องตั้งproxy_buffering offเอง (หรือให้ backend ส่งX-Accel-Buffering: no) ↩ -
Cloudflare, Default cache behavior — Client-side range requests Cloudflare cache range request ได้และรองรับ streaming response แต่ free plan มี rate limit เพิ่มเติมที่อาจ throttle SSE ที่เปิดค้างไว้นาน Cloudflare ถอดหน้า
cache/concepts/streaming/ของเวอร์ชันก่อน ๆ ออกไปแล้ว ก่อนเผยแพร่ภายนอกควรเช็กพฤติกรรมของ free plan กับ traffic จริงของคุณเองก่อน ↩ -
AWS, Application Load Balancer — Idle timeout default 60s สูงสุด 4000s ↩
-
ตัวเลขประกอบตัวอย่าง จาก inference ของ Llama 3.1 70B Q4 บน H100 SXM ใบเดียว ตัวเลขจริงขึ้นกับโมเดล, batch size และ flag ของ vLLM engine ก่อนเอาไปอ้างที่อื่น ควรวัดบนฮาร์ดแวร์ของคุณเองก่อน ↩
Discussion
Have thoughts on this post? Share them below — questions, corrections, or your own experience are all welcome.