惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

雷峰网
雷峰网
宝玉的分享
宝玉的分享
I
InfoQ
P
Privacy International News Feed
V
V2EX
IT之家
IT之家
S
SegmentFault 最新的问题
D
Darknet – Hacking Tools, Hacker News & Cyber Security
V2EX - 技术
V2EX - 技术
C
CERT Recently Published Vulnerability Notes
C
Check Point Blog
The Register - Security
The Register - Security
爱范儿
爱范儿
博客园 - 三生石上(FineUI控件)
AWS News Blog
AWS News Blog
M
MIT News - Artificial intelligence
C
Cyber Attacks, Cyber Crime and Cyber Security
F
Fortinet All Blogs
B
Blog
N
Netflix TechBlog - Medium
B
Blog RSS Feed
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Last Week in AI
Last Week in AI
T
Threatpost
Forbes - Security
Forbes - Security
U
Unit 42
A
Arctic Wolf
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
P
Palo Alto Networks Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Recorded Future
Recorded Future
L
Lohrmann on Cybersecurity
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
月光博客
月光博客
Spread Privacy
Spread Privacy
MongoDB | Blog
MongoDB | Blog
Jina AI
Jina AI
I
Intezer
V
Visual Studio Blog
阮一峰的网络日志
阮一峰的网络日志
The Hacker News
The Hacker News
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
L
LangChain Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
博客园_首页
MyScale Blog
MyScale Blog
腾讯CDC
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
量子位

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
I Stopped Restarting HTTP Connections Between AI Models. Here Is What I Use Instead.
Artemii Amel · 2026-05-03 · via DEV Community

A 5-stage AI pipeline where each model takes 200ms of compute time should take about 1 second. In practice it often takes 1.75 seconds or more. The extra 750ms is not your models. It is your transport.

This post is about what happens when you replace per-request HTTP connections between model services with persistent tunnels, why the difference matters more than most people think, and how to implement it with a Go orchestrator that looks like normal HTTP but routes over encrypted P2P connections.

The problem with per-request HTTP between models

The standard setup for a multi-model pipeline is simple: each model exposes a REST endpoint, the orchestrator calls them in sequence, HTTP keep-alive reuses connections where possible. This works fine in development and falls apart in production in a few specific ways.

Every HTTPS request that can't reuse a keep-alive connection pays the full setup cost: DNS lookup (~5ms, cached after first), TCP handshake (~10ms, 1 RTT), TLS negotiation (~30ms, 2 RTTs). That is 45ms of overhead before a single token is processed. Across a 5-stage pipeline that is 225ms of pure networking waste per request.

HTTP keep-alive helps but is fragile. Keep-alive connections expire after idle timeouts (typically 60 seconds on most servers). Load balancers reshuffle them. If any of your model services sit behind NAT or change IP addresses, you cannot use keep-alive reliably at all because each service needs a stable public endpoint.

There is also the VRAM problem that forces distributed pipelines in the first place. A 7B model requires roughly 14 GB of VRAM in FP16. Two models exhaust a consumer GPU. Three crash the process. Spreading models across machines is the reliable answer, but then you have introduced a network dependency that you need to manage carefully.

What a persistent tunnel changes

Pilot Protocol gives each agent a permanent 48-bit virtual address and establishes encrypted UDP tunnels between them. The tunnels stay open with keepalive probes every 30 seconds and a 120-second idle timeout. The tunnel survives network changes, NAT rebinding, and transient packet loss without reconnecting at the application layer.

The result is that you pay the connection setup cost exactly once per agent pair, not once per request. From the benchmarks in the Pilot documentation, a 3-stage model chain processing 1,000 sequential inference requests sees:

Transport Per-request network overhead 1,000 requests total
Per-request HTTPS ~150ms/req (20%) ~750s
HTTP keep-alive ~20ms/req (3%) ~625s
Pilot persistent tunnel ~5ms/req (<1%) ~605s

The tunnel reduces per-request overhead to under 5ms. Over 1,000 requests that is roughly 145 seconds saved compared to per-request HTTPS. For latency-sensitive pipelines this also eliminates tail latency spikes from sporadic TLS handshakes and DNS timeouts.

The more significant advantage is resilience. Keep-alive connections die after idle timeouts. Pilot tunnels actively maintain themselves. If a probe fails, the tunnel reconnects automatically. Long-running inference pipelines that process traffic over hours stop getting transient connection failures from expired keep-alive connections.

The architecture

Each machine in the pipeline runs a Pilot daemon and a model server. The model server listens on port 80 over the Pilot overlay. The orchestrator connects to each model agent once at startup, then reuses those tunnels for every inference call.

Machine A (A100 80GB):  LLM agent       address 1:0001.0001.0001
Machine B (T4 16GB):    Whisper agent   address 1:0001.0002.0001
Machine C (A10G 24GB):  Image agent     address 1:0001.0003.0001
Machine D (CPU):        Orchestrator    address 1:0001.0004.0001

Enter fullscreen mode Exit fullscreen mode

Each model agent registers capability tags at startup:

# On Machine A (LLM)
pilotctl set-tags model-service llm reasoning

# On Machine B (Whisper)
pilotctl set-tags model-service whisper audio

# On Machine C (Image gen)
pilotctl set-tags model-service diffusion image

Enter fullscreen mode Exit fullscreen mode

The orchestrator discovers available models by tag at startup, not by hardcoded address:

pilotctl find-by-tag model-service --json

Enter fullscreen mode Exit fullscreen mode

This means you can add, remove, or replace model agents without changing orchestrator configuration.

The Go orchestrator

Here is the full orchestrator. The key detail is d.HTTPTransport() which returns a net/http.RoundTripper that routes requests through Pilot tunnels. The http.Client uses it transparently. The code looks like normal HTTP. There are no DNS lookups, no TCP handshakes, no TLS negotiations per request.

package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io"
    "net/http"
    "time"

    "github.com/TeoSlayer/pilotprotocol/pkg/driver"
)

var (
    llmAddr     = "1:0001.0001.0001"
    whisperAddr = "1:0001.0002.0001"
    imageAddr   = "1:0001.0003.0001"
)

type ChainResponse struct {
    Transcript string `json:"transcript"`
    Analysis   string `json:"analysis"`
    ImageURL   string `json:"image_url"`
    TotalMs    int64  `json:"total_ms"`
}

func main() {
    d, err := driver.Connect()
    if err != nil {
        panic(err)
    }

    // Listen on port 80 over the Pilot overlay
    ln, err := d.Listen(80)
    if err != nil {
        panic(err)
    }

    // HTTP client that routes through persistent Pilot tunnels
    client := &http.Client{
        Transport: d.HTTPTransport(),
        Timeout:   60 * time.Second,
    }

    mux := http.NewServeMux()
    mux.HandleFunc("/chain", func(w http.ResponseWriter, r *http.Request) {
        start := time.Now()

        var req struct{ AudioURL string `json:"audio_url"` }
        json.NewDecoder(r.Body).Decode(&req)

        // Stage 1: transcribe audio
        transcript, err := callModel(client, whisperAddr, "/v1/transcribe",
            map[string]string{"audio_url": req.AudioURL})
        if err != nil {
            http.Error(w, err.Error(), 500)
            return
        }

        // Stage 2: analyze transcript
        analysis, err := callModel(client, llmAddr, "/v1/completions",
            map[string]string{"prompt": "Summarize key points: " + transcript})
        if err != nil {
            http.Error(w, err.Error(), 500)
            return
        }

        // Stage 3: generate visualization
        imageURL, err := callModel(client, imageAddr, "/v1/generate",
            map[string]string{"prompt": "Infographic for: " + analysis})
        if err != nil {
            http.Error(w, err.Error(), 500)
            return
        }

        json.NewEncoder(w).Encode(ChainResponse{
            Transcript: transcript,
            Analysis:   analysis,
            ImageURL:   imageURL,
            TotalMs:    time.Since(start).Milliseconds(),
        })
    })

    fmt.Println("Orchestrator listening on port 80")
    http.Serve(ln, mux)
}

func callModel(client *http.Client, addr, path string, payload any) (string, error) {
    body, _ := json.Marshal(payload)
    // Routes through the existing persistent tunnel - no connection overhead
    resp, err := client.Post(
        fmt.Sprintf("http://%s%s", addr, path),
        "application/json",
        bytes.NewReader(body),
    )
    if err != nil {
        return "", err
    }
    defer resp.Body.Close()
    result, _ := io.ReadAll(resp.Body)
    var parsed struct{ Result string `json:"result"` }
    json.Unmarshal(result, &parsed)
    return parsed.Result, nil
}

Enter fullscreen mode Exit fullscreen mode

The tunnel between orchestrator and each model agent is established when the http.Client first makes a request to that address. After that, every subsequent call to the same address reuses the existing tunnel. No reconnect, no negotiation. Just the packet hitting the other end.

What is happening under the hood

The transport layer in Pilot Protocol is a userspace reliable stream built over UDP. It implements a sliding window for flow control, AIMD congestion control (the same algorithm family TCP uses), and Nagle's algorithm to coalesce small writes. The reason this is built on UDP rather than TCP is NAT traversal: STUN hole-punching works at the UDP layer, which means two agents behind different NATs can establish a direct connection without either needing a public IP.

Encryption uses X25519 key exchange and AES-256-GCM per tunnel, implemented in pure Go with zero external dependencies. The entire crypto stack is Go's standard library: crypto/ecdh, crypto/aes, crypto/cipher, crypto/ed25519. No CGO, no OpenSSL bindings. The binary has no external dependencies.

Since the Conn type implements Read, Write, SetDeadline, and Close, it satisfies Go's standard net.Conn interface. This is what makes the HTTP server work over it without modification. For more detail on the full transport implementation, see Building a Userspace TCP-over-UDP Stack in Pure Go.

When this is worth the complexity

Distributed model chaining with persistent tunnels is the right choice when:

Models exceed single-machine VRAM. If your pipeline needs three models that each require 20+ GB of VRAM, you physically cannot fit them on one GPU. Distribute them.

Models need different hardware. LLMs benefit from A100s. Whisper runs well on T4s. Image generation needs different batch sizes. Matching model to hardware saves cost. Pilot's tag-based discovery makes this transparent to the orchestrator.

Models have different scaling profiles. Your LLM handles 10 requests/second. Your embedding model handles 1,000. Running them on the same machine wastes capacity. Scale them independently.

Pipeline processes sustained traffic. The tunnel amortizes its setup cost across every request. For pipelines processing hundreds to thousands of requests per hour, the savings compound. For a pipeline that runs twice a day, per-request HTTP is fine.

Single-machine serving is better for simple pipelines, sub-200ms hard latency requirements (no network can beat local function calls), or cases where all models fit comfortably in VRAM together.

Getting started

Install Pilot on each model machine, start the daemon, tag each agent with its capabilities, and use driver.Listen(80) in your model server. The orchestrator discovers agents by tag and routes through persistent tunnels from that point.

# Each machine
curl -fsSL https://pilotprotocol.network/install.sh | sh
pilotctl daemon start --email model-service@example.com
pilotctl join --network 1
pilotctl set-tags model-service llm   # or whisper, diffusion, etc.

Enter fullscreen mode Exit fullscreen mode

The only shared infrastructure is the rendezvous server for initial discovery. The public one at pilotprotocol.network works out of the box, or you can self-host. After the initial handshake, all model traffic is direct P2P between the machines with no intermediary.

For the encryption details, see Encrypting Agent Traffic with Zero External Dependencies. For how the trust model controls which agents can connect to which, see How Pilot Protocol Works.


Network on standard UDP providing permanent 48-bit virtual addressing, authenticated encrypted channels, and direct p2p transport.
curl -fsSL https://pilotprotocol.network/plain
curl -fsSL https://pilotprotocol.network/install.sh | sh
Agents using this gain sovereign identity and direct coordination without human intermediaries or centralized platforms.