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

推荐订阅源

Engineering at Meta
Engineering at Meta
T
Threatpost
P
Palo Alto Networks Blog
NISL@THU
NISL@THU
O
OpenAI News
Project Zero
Project Zero
G
GRAHAM CLULEY
P
Privacy International News Feed
A
Arctic Wolf
Microsoft Azure Blog
Microsoft Azure Blog
H
Help Net Security
M
MIT News - Artificial intelligence
T
Threat Research - Cisco Blogs
S
Security @ Cisco Blogs
Google DeepMind News
Google DeepMind News
B
Blog RSS Feed
D
Docker
aimingoo的专栏
aimingoo的专栏
博客园 - 【当耐特】
N
Netflix TechBlog - Medium
云风的 BLOG
云风的 BLOG
雷峰网
雷峰网
W
WeLiveSecurity
P
Proofpoint News Feed
腾讯CDC
Cloudbric
Cloudbric
S
Secure Thoughts
C
Check Point Blog
博客园 - Franky
T
The Exploit Database - CXSecurity.com
T
Troy Hunt's Blog
GbyAI
GbyAI
Security Archives - TechRepublic
Security Archives - TechRepublic
Application and Cybersecurity Blog
Application and Cybersecurity Blog
月光博客
月光博客
C
Cyber Attacks, Cyber Crime and Cyber Security
I
Intezer
TaoSecurity Blog
TaoSecurity Blog
L
Lohrmann on Cybersecurity
V
Visual Studio Blog
F
Fortinet All Blogs
博客园 - 叶小钗
C
CXSECURITY Database RSS Feed - CXSecurity.com
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recorded Future
Recorded Future
C
Cisco Blogs
博客园 - 司徒正美
Stack Overflow Blog
Stack Overflow Blog
Y
Y Combinator Blog
Apple Machine Learning Research
Apple Machine Learning Research

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
Anka: Designing a Minimal HTTP Server for Native AOT, Its Architecture, and Intentional Constraints
Selçuk GÜRAL · 2026-05-02 · via DEV Community

In modern backend systems, being “fast” alone is no longer enough. How quickly your service responds to the first request, how little memory it consumes at startup, and how predictably it behaves are now just as important as raw throughput. Especially in serverless, short-lived container, edge worker, and bursty internal service scenarios, the real problem is often not steady-state throughput, but cold start performance, startup allocations, and operational simplicity.

Anka approaches this problem from the opposite direction of the traditional ASP.NET Core model: no middleware pipeline, no built-in routing, no TLS, no HTTP/2. Instead, it provides a Native AOT-friendly, HTTP/1.x-focused, allocation-conscious HTTP server core built on .NET 8+. The goal is straightforward: once the process starts, begin listening on the socket within milliseconds and keep the connection/request lifecycle as deterministic as possible.


The Problem

The traditional .NET web stack is extremely powerful, but that power comes with a cost. Middleware chains, reflection-heavy surfaces, dynamic extensibility, broad protocol support, and JIT warmup all introduce significant overhead on the cold-start path. If your actual requirement is simply:

“Open a socket, parse HTTP/1.1, execute a handler, and write the response,”

then the general-purpose framework model can become unnecessarily expensive.

The core question Anka focuses on is:

If we do not need a full-featured web framework, but only a fast-starting, low-memory, Native AOT-compatible HTTP listener, what should the minimum architecture look like?

The answer becomes visible in the performance characteristics as well. In measured environments, Anka reaches a time-to-ready of approximately 2.3 ms, startup allocations around 124.5 KB, and a steady-state RSS of roughly 15 MB. Kestrel, by comparison, offers a much broader feature set, but carries a heavier cold-start and memory profile. Interestingly, throughput differences are not dramatic; Anka’s real advantage is not raw requests-per-second, but startup cost and footprint.


Architecture: Minimal Layers, Maximum Control

Anka’s architecture is intentionally narrow:

Server.StartAsync()
-> parallel accept loops
-> Connection.RunAsync() (one task per TCP connection)
-> SocketReceiver.ReceiveAsync()
-> HttpParser
-> RequestHandler(request, response, ct)
-> HttpResponseWriter.WriteAsync()

Enter fullscreen mode Exit fullscreen mode

The important aspect of this flow is that there is very little abstraction. Request processing starts directly at the socket layer and ends directly at the socket layer.


Server: The Acceptance Layer

The server opens the listening socket, configures the backlog, and runs multiple parallel accept loops instead of a single accept loop. This may sound like a small detail, but under burst traffic it prevents a single accept loop from serializing connection acceptance.

Additionally, the minimum thread pool size is increased to reduce thread injection latency during initial load. This may look like benchmark tuning, but in reality it is an operational decision intended to make cold-path behavior more deterministic.


Connection: The Real Unit of Execution

A Connection task is created for each TCP connection. This object:

  • rents a pooled receive buffer,
  • acquires a pooled HttpRequest,
  • creates a connection-scoped HttpResponseWriter,
  • reads and parses data from the socket,
  • invokes the request handler,
  • and if keep-alive is enabled, continues with the next request using the same resources.

The critical idea here is resource ownership at the connection level rather than the request level. This minimizes repetitive buffer rental and return operations across keep-alive requests.


SocketReceiver: Async I/O with Allocation Discipline

Instead of using the more convenient Socket.ReceiveAsync(Memory) APIs, Anka uses SocketAsyncEventArgs together with IValueTaskSource.

This is not micro-optimization for its own sake. The goal is to avoid state machine overhead and additional allocations when socket reads complete synchronously.

In loopback or LAN scenarios, data is often already available in the kernel buffer. In those cases, the receive operation completes synchronously and the system proceeds with almost direct function-call overhead. If data is not available, the OS I/O completion thread finishes the operation, while continuations are posted back to the thread pool using RunContinuationsAsynchronously = true.

The result: I/O threads are not blocked by request-processing work.


HttpParser: Single-Pass Parsing

The parser’s real value is not merely that it parses HTTP, but that it does so in a single pass using pooled buffers.

It performs:

  • request line parsing,
  • path/query separation,
  • lowercase normalization of header names during ingestion,
  • inline Content-Length tracking,
  • request body reading when necessary,
  • chunked request body decoding and reassembly into req.Body,
  • keep-alive decision calculation during parsing.

This approach provides two important benefits:

  1. No second header scan is required.
  2. The HttpRequest passed to the handler is already in a usable, near zero-copy state.

HttpResponseWriter: Not a Framework, Just Wire Format

The response layer follows the same philosophy. HttpResponseWriter constructs the HTTP response header block inside a pooled buffer, inlines small bodies into the same buffer whenever possible, and writes directly through Socket.SendAsync().

Another important design choice here is the absence of chunked response encoding. All responses use Content-Length.

This constraint simplifies the response pipeline significantly and narrows the execution path for AOT and low-allocation goals.


Core Design Decisions

A Single RequestHandler Delegate

Anka has no middleware chain. There is only one RequestHandler.

This is a deliberate form of radical simplification.

Benefits

  • shorter call chains,
  • fewer abstraction layers,
  • lower dispatch overhead,
  • a cleaner surface for Native AOT.

Costs

  • cross-cutting concerns must be implemented manually,
  • routing, authentication, logging, and metrics are not framework-managed.

This is not an “incomplete framework”; it is a primitive-oriented design.


No Built-in Routing

Path dispatching is left entirely to user code. A simple switch statement is considered sufficient for many scenarios.

At first glance this may appear primitive, but routing costs are not limited to path matching itself. Routing systems also bring metadata graphs, endpoint conventions, and large API surfaces. Anka rejects that cost upfront.


Lowercasing Header Names During Ingestion

Instead of performing case-insensitive lookups repeatedly, header names are normalized during parsing. This allows lookups to use straightforward SequenceEqual comparisons.

It may seem like a small design detail, but on the hot path it reduces both branching and processing overhead.


Reusing HttpRequest and Buffers Across Connections

The HttpRequest.ResetForReuse() approach avoids discarding request objects after every request. The same object is reused throughout the connection lifetime.

This becomes especially effective under keep-alive workloads, because steady-state allocation reductions often come not from huge optimizations, but from many small, systematic reuse decisions.


Small CAS-Based Request Pool

The HttpRequestPool is lock-free and intentionally small.

The goal is not theoretical “infinite pooling,” but a practical, cache-friendly, low-overhead reuse mechanism. If all slots are occupied, objects are simply discarded.

This is another important engineering decision: trying to pool everything can sometimes become more expensive than not pooling at all.


Trade-offs: What This Architecture Gains — and Intentionally Gives Up

One of Anka’s strengths is that it clearly communicates what it is not.

Decision Benefit Cost
No middleware Shorter hot path, fewer abstractions Developers handle cross-cutting concerns
No built-in routing Lower startup cost, simpler model Reduced ergonomics in large APIs
HTTP/1.x only Narrower execution path, simpler AOT surface No modern protocol features
No built-in TLS Keeps the core minimal Reverse proxy becomes mandatory
No chunked responses Simpler response writer Limited streaming ergonomics
Raw socket approach Full control over allocations and behavior Higher maintenance burden

The most important trade-off is this:

Anka does not exist to replace Kestrel. It exists to occupy a different optimization point.

If you need HTTP/2, TLS termination, middleware ecosystems, advanced hosting integrations, or rich observability plugins, then Kestrel is probably still the correct answer.

But if your priority is low footprint, rapid readiness, and a highly controlled request path, Anka becomes compelling.


The Strongest Part of This Design: Predictability, Not Performance

In my opinion, the real value here is not just “0 B allocations” or “2.3 ms startup.”

The real value is how easy it becomes to mentally model the system:

  • one task per connection,
  • connection-scoped buffers,
  • parse → handle → write pipeline,
  • very few failure states,
  • limited protocol surface.

Architecturally, systems like this become valuable not because of benchmark presentations, but because of operational clarity. You know exactly what the system does, what it does not do, where behavior changes under load, and where costs are paid.


Example Use Cases

Serverless or Short-Lived Container APIs

If cold start is critical and the endpoint surface is small, Anka’s minimal startup overhead becomes a major advantage.


Sidecar / Internal Control Plane Endpoints

For health checks, readiness probes, metrics gateways, or simple control APIs, a full framework is often unnecessary.


Edge Compute and Appliance Deployments

Low RSS and Native AOT compatibility matter significantly in resource-constrained environments.


Benchmarking and Protocol Research

Anka provides a clean environment for teams that want to observe HTTP pipeline behavior without framework noise.


Narrowly Scoped, High-Control Services

It is well suited for single-purpose webhook receivers, internal callback endpoints, or lightweight ingestion services.


When I Would Not Use It

Personally, I would avoid this architecture for:

  • large general-purpose product APIs developed by big teams,
  • applications requiring rich middleware ecosystems,
  • systems where streaming, TLS, or HTTP/2 are first-class requirements,
  • organizations where framework integrations matter more than low-level control.

Because what you gain here is not “freedom.”

It is control.

And control always comes with increased engineering responsibility.


Conclusion

The most accurate technical summary of Anka is this:

It is not an HTTP server that gains performance by adding optimizations on top of features; it gains simplicity and predictability by deliberately reducing scope.

Native AOT compatibility, low startup allocations, connection-scoped resource management, single-pass parsing, and direct socket writing all serve the same goal:

a small, fast-starting, understandable request pipeline.

This approach is not for everyone — and it is not trying to be.

From an experienced backend engineering perspective, its most mature characteristic is precisely this: it defines the problem narrowly, optimizes aggressively for that problem, and consciously leaves everything else outside the boundary.

And often, that is a far more valuable engineering decision than building a system that tries to do everything.