Skip to main content

AI & assistant-friendly summary

This section provides structured content for AI assistants and search engines. You can cite or summarize it when referencing this page.

Summary

C10k is solved until syscall overhead and context switches eat your Graviton cores. epoll, sendfile, and SO_REUSEPORT behaviors on EC2—and why Lambda caps concurrency differently.

Key Facts

  • C10k is solved until syscall overhead and context switches eat your Graviton cores
  • epoll, sendfile, and SO_REUSEPORT behaviors on EC2—and why Lambda caps concurrency differently
  • Linux on EC2 (June 2026) serves most self-hosted APIs
  • Zero-copy moves file → socket without user-space buffers—ideal for static assets behind NGINX on EC2 (often superseded by CloudFront)
  • When this advice breaks - TLS termination on instance — crypto dominates; offload to ALB/CloudFront first

Entity Definitions

Lambda
Lambda is an AWS service discussed in this article.
EC2
EC2 is an AWS service discussed in this article.
S3
S3 is an AWS service discussed in this article.
CloudFront
CloudFront is an AWS service discussed in this article.
ECS
ECS is an AWS service discussed in this article.

High-Concurrency Server I/O: epoll, Syscalls, and Zero-Copy on AWS EC2

Quick summary: C10k is solved until syscall overhead and context switches eat your Graviton cores. epoll, sendfile, and SO_REUSEPORT behaviors on EC2—and why Lambda caps concurrency differently.

Key Takeaways

  • C10k is solved until syscall overhead and context switches eat your Graviton cores
  • epoll, sendfile, and SO_REUSEPORT behaviors on EC2—and why Lambda caps concurrency differently
  • Linux on EC2 (June 2026) serves most self-hosted APIs
  • Zero-copy moves file → socket without user-space buffers—ideal for static assets behind NGINX on EC2 (often superseded by CloudFront)
  • When this advice breaks - TLS termination on instance — crypto dominates; offload to ALB/CloudFront first
High-Concurrency Server I/O: epoll, Syscalls, and Zero-Copy on AWS EC2
Table of Contents

Linux on EC2 (June 2026) serves most self-hosted APIs. Event loops use epoll (edge-triggered) to watch thousands of sockets per thread—contrast with kqueue on BSD/macOS dev laptops; production parity tests matter.

Syscall and context switch tax

Each read/write crossing user/kernel boundary costs CPU. Zero-copy sendfile() moves file → socket without user-space buffers—ideal for static assets behind NGINX on EC2 (often superseded by CloudFront).

PatternBenefit on AWS
epoll + non-blocking I/OFew threads, many connections on c7g Graviton
SO_REUSEPORTAccept queue spread across workers
sendfileStatic file serving from EBS

Lambda avoids your epoll tuning—concurrency is execution environment reuse with platform limits; CPU-bound work still belongs on EC2/ECS.

When this advice breaks

  • TLS termination on instance — crypto dominates; offload to ALB/CloudFront first.
  • Tiny payloads — syscall cost noise vs business logic.

What to do this week

  1. Compare nginx/envoy worker count to CPU cores on origin ASG.
  2. Profile with perf top during load test—look for syscall hotspots.
  3. Move static assets to S3+CloudFront; keep dynamic on epoll stack.

What this guide doesn’t cover

CPU cache false sharing—part 4 of this track.

PP
Palaniappan P

AWS Cloud Architect & AI Expert

AWS-certified cloud architect and AI expert with deep expertise in cloud migrations, cost optimization, and generative AI on AWS.

AWS ArchitectureCloud MigrationGenAI on AWSCost OptimizationDevOps

Recommended Reading

Explore All Articles »