Library / Blogs
Quora Engineering Blog
The engineering blog of Quora: posts on how it designs, builds and scales its systems.
By Quora engineers · Quora · Added 2026-10-12
All content belongs to Quora engineers / Quora. We only link to it and give credit. Report a problem
Learn this article
About 37 min left. Your work is saved as you go.
What you are about to study
Quora wrote this to explain how they thought about a problem. You should know the basics: caching, queues and replication.
Ideas you will meet
- Distributed Systems
- Consensus, time, failure and the fundamentals of scale-out.
What we already know about this
Our own lessons on these ideas. Read them here before you start, so it makes sense.
Networking and Web Security Deep Dive · 12 minNetwork layers, TCP, UDP, ports and socketsHow data travels: the layered models, what TCP and UDP promise, how ports and sockets let programs talk, and why this matters for design.Read here
Layers: why networks are divided
Networking is split into layers, each using the one below and hiding its details. Two models are used: the 7-layer OSI model (a teaching reference) and the 4-layer TCP/IP model (what the internet actually uses).
TCP/IP layer OSI layers What it does Examples Application 5 to 7 (session, presentation, application) Protocols programs speak HTTP, DNS, SMTP, TLS Transport 4 Delivery between programs TCP, UDP, QUIC Internet 3 (network) Addressing and routing between networks IP, ICMP Link 1 and 2 (physical, data link) Moving frames on one local network Ethernet, Wi-Fi 100%Figure SDA-NSD-01-1 · Layers wrapping a web request · © forcsguy.com
Each layer adds its own header on the way down (encapsulation) and removes it on the way up. Routers work at the internet layer (they look at IP addresses); switches at the link layer; load balancers and proxies at transport or application (see the load balancing lesson).
IP, in short
- IP address identifies a network interface; IPv4 has 32 bits (about 4.3 billion addresses, now scarce, hence NAT) and IPv6 has 128 bits.
- Packets are routed hop by hop; each router decides the next hop. IP is best effort: packets can be lost, duplicated or reordered. Higher layers fix that if needed.
- A subnet is a block of addresses sharing a prefix (for example
10.0.1.0/24), the basis of private networks and cloud network design. - DNS maps names to addresses (covered in the networking lesson of the foundations course).
TCP: reliable streams
TCP gives a reliable, ordered byte stream:
100%Figure SDA-NSD-01-2 · TCP connection life · © forcsguy.com
- Handshake costs a round trip before data (a reason connection reuse and HTTP keep-alive matter; TLS adds more).
- Sequence numbers and acknowledgements let it retransmit lost data and reorder.
- Flow control (receive window) stops a fast sender overwhelming a slow receiver.
- Congestion control slows down when the network is congested; a new connection starts slowly (slow start), so short connections to far servers are slow.
- Head-of-line blocking: one lost segment stalls everything behind it on that connection. HTTP/3 over QUIC addresses this (see the HTTP evolution lesson).
UDP: just datagrams
UDP sends independent datagrams with no connection, ordering or retransmission. It is lightweight and low latency, used for DNS, voice and video, games, and as the base of QUIC, which rebuilds reliability and encryption on top of UDP with per-stream independence. Choose UDP when the application can tolerate loss or wants its own reliability rules.
Ports and sockets
A port (0 to 65535) identifies a program on a machine: HTTP 80, HTTPS 443, SSH 22, DNS 53, PostgreSQL 5432, Redis 6379. A socket is the endpoint a program uses: an IP address plus a port plus a protocol. A TCP connection is uniquely identified by the four values source IP, source port, destination IP, destination port; that is why one server port can serve thousands of clients.
import net from "node:net"; const server = net.createServer((socket) => { // one socket per connected client socket.on("data", (buf) => socket.write(`echo: ${buf}`)); }); server.listen(9000); // listening socket on port 9000Operating systems limit open sockets (file descriptors) and ephemeral ports; heavy services tune these and reuse connections.
Why designers care
- Latency is dominated by round trips: handshakes, DNS, TLS. Reuse connections, use CDNs, keep data close.
- Bandwidth versus latency: a fat pipe does not make a round trip shorter (see the latency lesson).
- Packet loss hurts TCP throughput; mobile networks need resilient protocols.
- Choosing a transport: TCP for most request/response work, UDP/QUIC for real-time or when you need per-stream independence.
- Debugging:
pingandtraceroutefor reachability and path,digfor DNS,curl -vfor HTTP and TLS,ssornetstatfor sockets,tcpdumpor Wireshark for packets.
Real-world reading
Related reading
- Cloudflare BlogCloudflare engineers · CloudflareBlogs
- Chrome Developers BlogGoogle engineers · GoogleBlogs
- Android Developers BlogGoogle engineers · GoogleBlogs
- The Road to QUICCloudflareBlogs
Show 6 moreShow fewer
- Julia Evans' BlogJulia Evans · jvns.caBlogs
- RFC 9000: QUICIETFDocumentation
- Web VitalsGoogle web.dev · GoogleDocumentation
- Active-Active for Multi-Regional ResiliencyNetflix Engineering · NetflixCase Studies
- IBM developerWorks Engineering BlogIBM developerWorks engineers · IBM developerWorksBlogs
- Quora Engineering BlogQuora engineers · QuoraBlogs
Go deeper on this
A path through videos, articles, other case studies and code on the same ideas as Quora Engineering Blog.
Warm upGet the vocabulary first.
Books · Free from the author
Concurrent and Distributed Systems (Cambridge lecture notes)
Eight lectures on time, broadcast, replication, consensus and transactions, with notes, slides and video. Free from the author under CC BY-SA.
University of CambridgeIntermediate
Books · Free from the author
Computer Networks: A Systems Approach
How networks are built and why: protocols, routing, congestion control and the internet's architecture. The authors publish it free online under CC BY 4.0.
Systems ApproachIntermediate
WatchHow others solve the same problem, on video.
Videos belong to their creators and play from YouTube. More on YouTube (opens in a new tab)
ReadEngineers explain it in their own words.
Blogs · Free from the author · Read here
Scalable Web Architecture and Distributed Systems
A full chapter on the building blocks of large websites: availability, performance, reliability, scalability, caches, proxies, indexes, load balancers and queues. Free to read here under CC BY 3.0.
The Architecture of Open Source ApplicationsBeginner40 min
Papers · Read here
Facebook’s photo storage
This paper describes Haystack, an object storage system optimized for Facebook’s Photos application. Facebook currently stores over 260 billion images, which translates to over 20 petabytes of data.
USENIXIntermediate
See it in another companyThe same ideas, a different system.
Case Studies · Read here
Aroma: Using ML for Code Recommendation at Facebook
Thousands of engineers write the code to create our apps, which serve billions of people worldwide. This is no trivial task—our services have grown so diverse and complex that the codebase contains…
FacebookIntermediate
Case Studies · Read here
Brooklin: Distributed Service for Near Real-Time Data Streaming at LinkedIn
Brooklin—a distributed service for streaming data in near real-time and at scale—has been running in production at LinkedIn since 2016, powering thousands of data streams and over 2 trillion messages per day. Today, w...
LinkedInIntermediate
Read the codeSee how it looks when it is real.
GitHub
Engineering Blogs
A huge directory of company engineering blogs to learn from real production systems.
kilimchoiIntermediate
GitHub
Awesome Scalability
Curated reading list of articles on the architecture of scalable, reliable systems.
binhnguyennusIntermediate
Keep learning
Loading community…