Understanding the End-to-End Process of a Web Request: IP, DNS, CDN, TCP, CGI/FastCGI, Server Models, and Data Layer Evolution
This article explains the complete journey of a web request—from IP addressing, DNS resolution, and CDN acceleration, through TCP stream handling and message framing, to CGI/FastCGI execution, server model choices, and the evolution of data-layer architectures for scalable applications.
When you type a URL like qq.com and press Enter, the request passes through several layers: IP addressing, DNS resolution, CDN selection, TCP transmission, server-side processing (CGI/FastCGI), and finally data retrieval from databases or caches.
1. IP, DNS, and CDN – Private IP ranges (10.x.x.x, 172.16‑31.x.x, 192.168.x.x) are used inside LANs, while NAT translates them to public IPs. DNS converts human‑readable domain names to IP addresses, and CDNs return a nearby IP to reduce latency.
2. TCP, Message Framing, and Protocol Design – TCP is a stream protocol without message boundaries, requiring the application to define its own framing (e.g., HTTP uses \r\n\r\n and Content‑Length ). Binary protocols often prefix messages with a length field, and may include simple checksums.
3. CGI and FastCGI – CGI launches a new process per request, passing data via environment variables and standard I/O. An example CGI program in C++:
#include
#include
int main()
{
printf("Content-type: text/html\r\n\r\n");
printf("your name is:%s\n", getenv("QUERY_STRING"));
return 0;
}FastCGI improves performance by keeping worker processes alive and communicating with the web server over sockets, eliminating the fork overhead.
4. Server Models – The "Web" model follows a request‑response, stateless, synchronous pattern, while the "Svr" model uses long‑lived connections, asynchronous communication, and can push data to clients (e.g., WebSocket).
5. Data‑Layer Evolution – Starting from simple MySQL point queries, the architecture progresses through database tuning, sharding (分库分表), read‑write separation, and finally caching with Redis to handle massive scale. Each step addresses performance bottlenecks and cost considerations.
By understanding these layers, developers can build more efficient, scalable, and maintainable web systems.
DevOps
Share premium content and events on trends, applications, and practices in development efficiency, AI and related technologies. The IDCF International DevOps Coach Federation trains end‑to‑end development‑efficiency talent, linking high‑performance organizations and individuals to achieve excellence.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.