Welcome to the third lesson in your system design course. So far, we have laid the essential groundwork. We started by translating ambiguous problems into concrete functional and non-functional requirements. In the last lesson, you mastered back-of-the-envelope estimation, turning those requirements into hard numbers for traffic, storage, and bandwidth.
Today, we'll build directly on that foundation by learning how to sketch a high-level architecture diagram. This is the stage where your abstract analysis transforms into a tangible structure. You will learn to select the right architectural components—load balancers, caches, databases, message queues—and connect them in a way that directly addresses the requirements and scale estimates you've calculated. For a senior engineer, this is a pivotal moment in the interview; it's your chance to demonstrate a holistic understanding of how distributed systems are composed, providing a visual roadmap for the entire conversation.
By the end of this lesson, you will be able to take a set of requirements and confidently draw a coherent high-level architecture, justifying each component and connection with the data-driven reasoning you developed in our previous sessions.
From Numbers to Boxes and Arrows
A high-level diagram is more than just a collection of standard components; it's a story about how a system handles its load. The estimations you performed in the previous lesson are the direct inputs for your architectural choices.
- A high Queries Per Second (QPS) estimate (e.g., > 1,000) immediately signals the need for a load balancer and a horizontally scalable pool of application servers.
- A read-to-write ratio heavily skewed towards reads (e.g., 100:1) points to an aggressive caching strategy and possibly database read replicas.
- A requirement to store large media files (images, videos) makes object storage (like AWS S3) a clear choice over a traditional database.
- The need for time-consuming, non-blocking operations, like video transcoding or sending push notifications, dictates the use of a message queue and a set of asynchronous worker services.
- The necessity for low-latency content delivery to a global user base justifies integrating a Content Delivery Network (CDN).
Your diagram should visually represent these decisions. The key is not just to draw the boxes, but to be able to explain why each box is there, referencing the specific requirements and scale you've identified.
Case Study 1: Sketching a URL Shortener
Let's begin with a familiar example: the URL shortener. In the last lesson, we estimated its requirements. Now, let's design it. A naive first attempt might look like this: Client -> Web Server -> Database.
This is a valid starting point, but it fails to meet the demands of a large-scale service. It has a single point of failure (SPOF) at both the web server and the database, and it cannot scale to handle high traffic. The following resource shows this evolution in thinking, moving from a rudimentary design to a scalable one.
System Design : Scalable URL shortener service ... - Medium
This article provides an excellent walkthrough of designing a URL shortener, starting with a basic diagram and then iterating on it to address scalability issues.
Focus on the section "5. High Level Design." First, examine the rudimentary design and the problems identified with it. Then, carefully study the improved, scalable design. Note how the addition of a load balancer, cache, and database sharding directly addresses the identified weaknesses.
The scalable design from the article, also depicted below, is the standard pattern for a robust web service.

This architecture effectively addresses the key requirements:
- High Availability: The load balancer can redirect traffic away from failed servers, and multiple application servers eliminate the single point of failure.
- Scalability: We can add more application servers behind the load balancer to handle increased QPS. The sharded database allows the data tier to grow.
- Low Latency (for reads): The cache serves requests for popular URLs directly from memory, significantly reducing load on the database and improving response time for users.
Case Study 2: Designing a Complex, Read-Heavy System
Now let's tackle a more complex problem, like Twitter or TikTok. These systems are characterized by a massive read-to-write imbalance and require a more sophisticated, microservices-based approach.
In a system like this, you don't have a single "Application Server." Instead, you have multiple, specialized services, each responsible for a distinct piece of functionality. The high-level diagram must show these services and how they communicate.
The diagram below illustrates a potential architecture for a Twitter-like service.

Let's break down what these specialized services do. The following guide provides an excellent overview of the core components in a Twitter-style design.
Design Twitter System Design: A Complete Guide
This guide from the System Design Handbook offers a production-grade overview of designing Twitter, detailing the core services and their specific responsibilities.
Read the section on high-level architecture. Pay close attention to the diagram and the responsibilities listed for each component: API Gateway, Tweet Service, User Service, Social Graph Service, and Timeline Service. This demonstrates how to break a monolithic problem into manageable, independent services.
By breaking the system into services like Tweet Service (handling the write path) and Timeline Service (handling the read path), the design allows each part to be scaled independently. If you have a 1000:1 read-to-write ratio, you might need 1000 instances of the Timeline Service for every one instance of the Tweet Service. This is the power of a microservices architecture.
The Process in an Interview
In an interview, you'll be drawing this on a whiteboard. The key is to communicate your thought process clearly as you go. The following mock interview videos are excellent examples of how senior candidates approach this.
System Design Mock Interview: Design TikTok ft. Google TPM
In this mock interview from Exponent, the candidate designs TikTok. Watch how he first designs the video upload flow and then separately designs the feed viewing flow, adding components as needed.
First, watch the candidate design the upload architecture. Notice how he separates the video metadata (which goes to a relational database) from the video file itself (which goes to blob storage). Next, observe how he designs the read-heavy view feed architecture, introducing a pre-cache service, a Redis cache, and read-only database replicas to optimize for low latency. This separation of read and write concerns is a hallmark of a strong design.
Design Youtube - System Design Interview
This video from NeetCode tackles the design of YouTube. The presenter clearly explains the components needed for both the upload (write) and watch (read) paths.
Watch how the presenter lays out the high-level design. He starts with the upload path, introducing application servers, object storage for raw files, and a NoSQL database for metadata. He then introduces the concept of asynchronous processing by adding a message queue and encoding services. Finally, he discusses the read path, adding a CDN and a metadata cache to ensure low-latency video playback.
From these examples, you can see a common pattern:
- Start with a core user flow (e.g., upload photo, view feed).
- Draw the main components required for that flow.
- Explain the role of each component and the data that flows between them.
- Move to the next user flow, adding or reusing components as necessary.
- Continuously refer back to your requirements (scalability, latency, etc.) to justify your choices.
Practice Exercise
Let's apply these principles. In the previous lesson's exercise, you performed back-of-the-envelope estimations for a simple photo-sharing service with these requirements:
- Users: 50 million DAU.
- Writes: 10% of users post one photo per day (Peak Write QPS: 100).
- Reads: Average user views 30 photos per day (Peak Read QPS: 30,000).
- Data: Average photo size is 2 MB. Total storage is 60 PB over 5 years.
- Bandwidth: Peak egress is 60 GB/s.
Your Task:
On a piece of paper or a whiteboard tool, sketch a high-level architecture diagram for this service. Don't worry about making it perfect; focus on identifying the key components and their connections based on the numbers above.
Once you have a sketch, click below to compare it with a sample solution.
Click for a sample solution description
Your diagram should capture two primary flows: the photo upload (write) path and the feed viewing (read) path. A good solution would include the following components and interactions:
Core Components:
- Clients: Mobile/Web App
- CDN (Content Delivery Network): To serve photo content globally with low latency. Essential given the 60 GB/s egress requirement.
- Load Balancer (LB): To distribute incoming API requests. Necessary to handle the 30,000 peak read QPS.
- API Servers: A horizontally-scalable fleet of servers that handle the main business logic (e.g., user authentication, feed generation, posting comments).
- Photo Upload Service: A dedicated service to handle the initial validation of an image upload.
- Message Queue (e.g., RabbitMQ, SQS): To decouple the upload request from the processing-intensive tasks.
- Photo Processing Workers: A pool of services that subscribe to the message queue to perform tasks like generating thumbnails, running moderation checks, and compressing images.
- Object Storage (e.g., AWS S3): For storing the actual photo files (original and processed versions). The 60 PB storage requirement makes this the only logical choice.
- Metadata Database (e.g., PostgreSQL, MySQL): A relational database to store user information, photo metadata (captions, tags, upload time, URL to the photo in S3), and the social graph (who follows whom).
- Cache (e.g., Redis): An in-memory cache to store user feeds, hot metadata, and session information to accelerate the 30,000 read QPS.
Flows:
-
Photo Upload (Write) Flow:
- The client sends a POST request with the photo to the Load Balancer, which routes it to an API Server.
- The API Server validates the request, stores the photo metadata (e.g.,
status: 'uploading') in the Metadata DB, and publishes a message (containingphotoIdanduserId) to the Message Queue. It then immediately returns a202 Acceptedresponse to the client. - A Photo Processing Worker consumes the message from the queue. It downloads the image, creates thumbnails, and uploads all versions to Object Storage.
- Finally, the worker updates the photo's record in the Metadata DB with the S3 URLs and sets its status to
status: 'processed'.
-
Feed Generation (Read) Flow:
- The client sends a GET request for the user's feed to the Load Balancer, which routes it to an API Server.
- The API Server first checks the Cache for the user's pre-generated feed.
- Cache Hit: If the feed exists, it's returned immediately. The photo URLs in the feed point to the CDN.
- Cache Miss: The API Server queries the Metadata DB to get the list of users the current user follows, then fetches the latest photo metadata from those users. It constructs the feed, stores it in the Cache for future requests, and returns it.
- The client receives the feed data (a list of posts with metadata and CDN URLs for the images) and then renders it, fetching the actual image files from the CDN.
Conclusion
You have now completed the third step of the system design framework. You've learned how to translate quantitative estimates into a structural blueprint of your system.
Here are the key takeaways:
- A high-level architecture diagram is the visual bridge between requirements and implementation.
- Every component in your diagram must have a purpose, directly justified by a functional requirement or a non-functional constraint (like QPS, storage, or latency).
- For complex systems, think in terms of specialized services (microservices) rather than a single monolithic application. This allows for independent scaling of read and write paths.
- In an interview setting, narrate your design process, explaining your choices as you draw.
With a high-level architecture in place, the next logical step in an interview is for the interviewer to probe for bottlenecks. They'll ask questions like, "What happens if this database gets overloaded?" or "How do you handle a sudden traffic spike?"
In our next lesson, we will focus on exactly that: identifying and prioritizing the most critical scalability bottlenecks in a given design. You'll learn to anticipate these questions and proactively discuss the weak points of your architecture and potential solutions.