Part 9— Complete System Design Series
System Design Made Easy…

Welcome back peeps. In the last part ( links below) we covered in detail ( with examples) —
Projects Videos —
All the projects, data structures, SQL, algorithms, system design, Data Science and ML , Data Analytics, Data Engineering, , Implemented Data Science and ML projects, Implemented Data Engineering Projects, Implemented Deep Learning Projects, Implemented Machine Learning Ops Projects, Implemented Time Series Analysis and Forecasting Projects, Implemented Applied Machine Learning Projects, Implemented Tensorflow and Keras Projects, Implemented PyTorch Projects, Implemented Scikit Learn Projects, Implemented Big Data Projects, Implemented Cloud Machine Learning Projects, Implemented Neural Networks Projects, Implemented OpenCV Projects,Complete ML Research Papers Summarized, Implemented Data Analytics projects, Implemented Data Visualization Projects, Implemented Data Mining Projects, Implemented Natural Leaning Processing Projects, MLOps and Deep Learning, Applied Machine Learning with Projects Series, PyTorch with Projects Series, Tensorflow and Keras with Projects Series, Scikit Learn Series with Projects, Time Series Analysis and Forecasting with Projects Series, ML System Design Case Studies Series videos will be published on our youtube channel ( just launched).
Subscribe today!
Solved System Design Case Studies — In depth
Design Instagram
Design Messenger App
Design Twitter
Design URL Shortener
Design Dropbox
Design Youtube
Design API Rate Limiter
Design Web Crawler
Design Facebook’s Newsfeed
Design Yelp
Design Uber
Design Tinder
Design Tiktok
Design Whatsapp
Most Popular System Design Questions
Mega Compilation : Solved System Design Case studies
All the Complete System Design Series Parts —
6. Networking, How Browsers work, Content Network Delivery ( CDN)
Moving forward, this is the part 9 of the system design series where we will be covering —
- Estimation and Planning
- Performance
Part 1 of this series can be found here —
Part 2 of this series can be found here —
Part 3 of this series can be found here —
Part 4 of this series can be found here —
Part 5 of this series can be found here —
Part 6 of this series can be found here —
Part 7 of this series can be found here —
Part 8 of this series can be found here —
And Most popular System Design Questions —
Let’s dive in!
Note : Please read System Design Important Terms you MUST know before reading this post.
Planning and Estimation
Pasta Resto Case:
As an owner of the pasta resto, when you started you had to come up with a plan to address the what, why and how of the pasta resto. Let’s revise our initial requirements and how you had to revise them as your customer base grew exponentially.
Initial Requirements and Estimations—
At a very basic level, what do you need?
1. Place to cook pasta
2. Chef who can cook delicious pasta
3. Customers
4. Waiters/Servers
5. Money
Revised Requirements and Estimations—
1. Place — Need more places to serve people at different locations
2. Chefs/Cook — Need to hire more chefs to cook and serve the orders as soon as possible and optimize the whole workload
3. Waiters/Servers — Need to hire more waiters/servers to serve hundreds of customers, give the best customer experience and great quality of service
4. Customers — Ever growing so there’s need a waiting area and approx. serving time estimate so that customers don’t leave hungry due to long queues.
5. Money — Need more money to open more chains at different locations.
6. Receptionist — Who can manage and well allot the load i.e customers
7. Software — Where you can store the customer details in case there’s a prior reservation made.
System Design Analogy:
Taking the same analogy, in system design — planning and estimation( numbers) are very important concepts ( concept that you should be able to demonstrate well when asked).

There are several strategies that can be used to solve capacity estimation problems faster:
- Use historical data: Utilize historical data to estimate future capacity requirements. This can include data on past usage patterns, resource utilization, and performance metrics.
- Automate capacity planning: Use automated tools to monitor resource usage and predict future capacity requirements. These tools can help identify bottlenecks and provide recommendations for scaling.
- Model-based approach: Develop mathematical models that represent the system and its components, and use these models to simulate future capacity requirements.
- Collaboration and communication: Collaborate with relevant stakeholders to gather requirements, and communicate effectively to ensure everyone is aligned on the capacity estimation process.
- Continuously monitor and re-evaluate: Regularly monitor the system’s capacity usage and re-evaluate the capacity estimation as necessary to ensure it remains accurate and relevant.
But before you proceed further, know how to ask right questions. Start with —
- Clarify the scope of the system — who’s going to the system and how many end users?
- Traffic — Requests per second, data writes/read per sec, bandwidth per operation etc
- High level Design ( i.e overview in brief and simple terms) : Read how to work with HLD.
- Monolithic or microservices architecture : which one to choose and when?
- Component Design: What are the main components of your design?
- API requirements : What are the important features that you want to design API’s for?
- Database Design and Constraints : How to store your data, how much each data entry costs, how much data to expect, indexing constraints, db read and writes, how to replicate/back up your data i.e no of servers, which db to use based on the requirements ( SQL or NoSQL)? How many shards to create or downsize when not required?
- Scaling — Whether to do horizontal scaling or vertical? How many CPU, RAM’s etc to use or add more machines or pool the resources?
- Load Balancing — how many load balancers are needed at the peak time? Or how many to downsize when the load is low? Whether to use software load balancers or hardware load balancers to save the cost?
- Concurrency — do you need to parallelize algorithms?
- Map — Reduce (Master — Slave techniques): How many data intensive operations/actions does your system perform/intends to execute?
- Caching and Proxies — Reverse or forward proxy to implement? Will in-memory caching help to improve the performance?
- Optimization — One of the most important planning and estimation topic. Some important things that help implement great optimizations — caching, storage, IO operations, db operations, capacity, policies at the large scale. We will cover this topic in detail in another post.
- Feasibility and Alternative analysis — What are the alternatives ( technical or operational) to present estimations? How feasible is each alternative: cost — operations — maintenance wise?
When we initially design the system, often we underestimate many things. So, planning and estimation is incredibly important and as we go further in this series we will cover how different applications like Watsapp, insta etc work with respect to the estimations.
Performance
Pasta Resto Case:
So, your pasta resto is running well — customers are happy, however; few things/internal departments at your resto you realize aren’t working as efficiently as they could. So, you put performance metrics like order turn around time, materials usage etc for each department to optimize and yield better results.
System Design Analogy:
Taking the same analogy, in system design — performance is a measurable metric with which one can determine ( not limited to )—
1. Components that are performing well
2. Components that are being bottleneck
3. Redundant modules
4. Throughput
5. DB operations — like which queries to optimize, caching the db etc
6. Lookup activities and system workload

7. IO operations
8. Reduced Availability and reliability
9. Excessive Hardware Exhaustion
10. Memory allocation and OS thrashing — excessive process and thread allocation
Estimation and Planning:
import math# Estimate the number of servers needed to handle a certain number of requests per second
requests_per_second = 1000
requests_per_day = requests_per_second * 3600 * 24
users_per_server = 1000
servers_needed = math.ceil(requests_per_day / (users_per_server * 86400))
print(f"Servers needed: {servers_needed}")# Create a project plan with tasks and estimated times
project_tasks = {
'Task 1': 5,
'Task 2': 10,
'Task 3': 15,
'Task 4': 20
}
total_time = sum(project_tasks.values())
print(f"Estimated project time: {total_time} hours")In the above code, we have estimated the number of servers needed to handle a certain number of requests per second and printed the result. We have also created a project plan with tasks and estimated times, and calculated the total time for the project.
Performance :
import time# Define a function to simulate a request
def simulate_request():
time.sleep(0.1)# Measure the time it takes to handle a certain number of requests
num_requests = 1000
start_time = time.time()
for i in range(num_requests):
simulate_request()
end_time = time.time()
total_time = end_time - start_time
print(f"Total time for {num_requests} requests: {total_time} seconds")
average_time_per_request = total_time / num_requests
print(f"Average time per request: {average_time_per_request} seconds")In the above code, we have defined a function to simulate a request and measured the time it takes to handle a certain number of requests. We have printed the total time for the requests and the average time per request.
Again, performance is one of the most important topic that we will cover in detail in another post as we work on the system design examples further.
More on Estimation, planning and Performance —
Estimation and planning are crucial aspects of system design that help ensure successful project execution. By accurately estimating project effort, resources, and timelines, teams can plan and allocate resources effectively, set realistic expectations, and deliver high-quality systems within the specified constraints.
Importance of estimation and planning in system design:
Accurate estimation and effective planning provide several benefits in system design:
- Predictability: Estimation and planning enable project teams to set clear expectations regarding project scope, timelines, and deliverables, increasing predictability and reducing uncertainties.
- Resource allocation: Estimation helps in identifying the required resources, such as human resources, infrastructure, and tools, for successful project execution. Planning allows for efficient allocation of these resources, ensuring they are available when needed.
- Risk mitigation: Estimation and planning help identify potential risks and dependencies early on. This allows teams to develop contingency plans and allocate resources to mitigate risks effectively.
- Stakeholder management: Accurate estimation and planning provide stakeholders with a clear understanding of project progress, timelines, and resource requirements. This improves communication, trust, and collaboration among all project stakeholders.
Agile vs. traditional (Waterfall) project management approaches:
Agile and traditional (Waterfall) project management approaches differ in their approach to estimation and planning:
- Agile: Agile methodologies, such as Scrum and Kanban, emphasize iterative and incremental development. Estimation and planning occur at regular intervals, typically during sprint or iteration planning meetings. The focus is on adaptive planning, continuous feedback, and flexibility to accommodate changing requirements.
- Waterfall: The Waterfall approach follows a sequential process, with distinct phases for requirements gathering, design, development, testing, and deployment. Estimation and planning occur primarily at the beginning of the project. The emphasis is on comprehensive upfront planning and adherence to the planned schedule.
Requirements Gathering and Analysis:
Techniques for gathering and analyzing system requirements:
- Interviews: Conducting interviews with stakeholders, subject matter experts, and end users to elicit their requirements and expectations.
- Surveys and questionnaires: Collecting information from a broader audience through surveys and questionnaires to gather requirements.
- Workshops and brainstorming sessions: Facilitating collaborative sessions with stakeholders to generate ideas, clarify requirements, and identify potential solutions.
- Prototyping: Developing interactive prototypes or mock-ups to gather feedback and validate requirements.
Prioritization and categorization of requirements:
Once requirements are gathered, prioritization and categorization help in managing and addressing them effectively:
- MoSCoW method: Prioritizing requirements as Must-have, Should-have, Could-have, and Won’t-have to focus efforts on critical functionality.
- Kano model: Categorizing requirements as Basic, Performance, Excitement, and Indifferent to understand their impact on user satisfaction and prioritize accordingly.
- User story mapping: Organizing requirements into a visual map, depicting user activities and their corresponding features to prioritize and plan iterations.
Identifying dependencies and constraints:
Dependencies and constraints play a crucial role in estimation and planning. Techniques for identifying dependencies and constraints include:
- Dependency analysis: Identifying relationships between requirements and tasks to understand dependencies and interdependencies.
- Constraint identification: Analyzing constraints such as budget limitations, resource availability, technical limitations, regulatory compliance, and external dependencies.
Effort Estimation:
Techniques for estimating project effort and duration:
- Expert judgment: Seeking input from domain experts or experienced team members to estimate effort and duration based on their expertise.
- Analogous estimation: Using historical data from similar projects as a reference to estimate effort and duration.
- Parametric estimation: Estimating effort and duration based on mathematical models, algorithms, or predefined formulas considering factors such as project size, complexity, and team productivity.
Factors affecting effort estimation accuracy:
- Project complexity: Complex projects with intricate requirements and dependencies tend to be more challenging to estimate accurately.
- Team experience: The level of experience and expertise of the project team members can impact the accuracy of effort estimation. More experienced teams are often better equipped to estimate effort accurately.
- Requirements clarity: The clarity and completeness of the requirements documentation directly influence the accuracy of effort estimation. Vague or ambiguous requirements can lead to inaccurate estimations.
- Technology familiarity: The team’s familiarity with the technologies and tools to be used in the project can affect estimation accuracy. Unfamiliar technologies may require additional time for learning and experimentation, impacting the overall effort.
- External dependencies: Dependencies on external factors, such as third-party services or dependencies on other projects or teams, can introduce uncertainties and affect estimation accuracy.
Resource Planning:
Identifying and allocating necessary resources (e.g., human resources, infrastructure):
- Human resources: Identify the required skill sets and roles for the project and allocate team members accordingly. Consider the availability, expertise, and workload of team members while allocating resources.
- Infrastructure: Determine the necessary hardware, software, and development tools required for the project. Allocate resources for development environments, testing environments, and production infrastructure.
Balancing resource availability and project timelines:
- Resource availability: Assess the availability of resources, including team members, infrastructure, and external dependencies. Consider any potential conflicts or overlaps in resource allocation and make adjustments accordingly.
- Project timelines: Evaluate the project timeline and deliverable milestones. Identify critical tasks and their dependencies to ensure resources are allocated optimally to meet project deadlines.
Risk management and contingency planning:
- Risk identification: Identify potential risks and uncertainties that may impact resource availability or project timelines. Analyze past experiences and gather input from stakeholders to identify potential risks.
- Risk mitigation: Develop contingency plans to address identified risks. Allocate additional resources, plan for alternative approaches, or establish backup options to mitigate potential risks.
Project Scheduling and Tracking:
Creating project schedules and timelines:
- Work breakdown structure (WBS): Break down the project into smaller, manageable tasks and create a hierarchical structure for organizing and scheduling the work.
- Task dependencies: Identify dependencies between tasks to establish the sequence and relationships among them. Use techniques like Gantt charts or network diagrams to visualize task dependencies and schedule them accordingly.
Techniques for tracking progress and managing project milestones:
- Agile methodologies: Use frameworks like Scrum or Kanban that provide iterative planning and tracking mechanisms. Track progress through daily stand-ups, sprint planning, and review meetings.
- Earned Value Management (EVM): Monitor project performance by measuring the value of work completed against the planned value. Track metrics like earned value, planned value, and actual cost to assess project progress.
Agile project management tools (e.g., Scrum, Kanban) and techniques:
- Scrum: Use Scrum framework with time-boxed iterations (sprints), backlog management, and daily stand-up meetings for tracking and managing project progress.
- Kanban: Utilize Kanban boards to visualize the workflow, limit work in progress (WIP), and track tasks as they move through different stages.
Performance:
Introduction to Performance:
Performance is a critical aspect of system design as it directly impacts user experience, system efficiency, and overall success of the application. Key reasons for focusing on performance include:
- User satisfaction: Faster response times, smooth interactions, and minimal delays contribute to a positive user experience, leading to increased user satisfaction and engagement.
- Scalability: A well-performing system can handle increasing workloads, user traffic, and data volume without significant degradation in performance. This allows for scalability and accommodates future growth and demands.
- Efficiency: Performance optimization reduces resource utilization, such as CPU usage, memory footprint, and network bandwidth, resulting in efficient system operation and cost savings.
- Competitive advantage: High-performance systems can differentiate a product or service from competitors by offering superior performance, reliability, and responsiveness.
Key performance metrics and indicators:
- Response time: The time taken by the system to respond to a user request or perform an operation. It measures the system’s speed and efficiency in processing and returning results.
- Throughput: The number of transactions, requests, or operations processed by the system within a given time period. It measures the system’s capacity to handle concurrent workloads.
- Latency: The delay experienced by a request or operation from the time it is initiated until it receives a response. It quantifies the time delay introduced by the system.
- Error rate: The frequency of errors or failures encountered during system operations. It measures the system’s reliability and stability.
- Resource utilization: The percentage of available system resources, such as CPU, memory, disk space, or network bandwidth, being utilized during system operation. It helps identify resource bottlenecks and potential areas for optimization.
Factors influencing system performance:
- Hardware capabilities: The underlying hardware infrastructure, including processors, memory, storage devices, and network components, significantly impacts system performance.
- Software design and architecture: The software design choices, such as algorithms, data structures, and system architecture, can influence performance. Well-designed and optimized software can enhance performance.
- Network latency and bandwidth: Network performance, including latency (delay) and available bandwidth, affects the speed of data transfer between components or systems, impacting overall system performance.
- Data volume and complexity: The size and complexity of data processed by the system can impact performance. Large datasets or complex computations can introduce processing delays and affect system responsiveness.
Performance Testing and Analysis:
Techniques for performance testing (e.g., load testing, stress testing):
- Load testing: Simulating realistic user loads and measuring system performance under expected workloads to assess its behavior and response times.
- Stress testing: Subjecting the system to extreme workloads or beyond its capacity limits to identify its breaking points and measure performance under stress conditions.
Tools and frameworks for performance testing and analysis:
- Apache JMeter: A popular open-source tool for load testing and performance measurement of web applications, APIs, and various protocols.
- Gatling: An open-source load testing tool designed for high-performance and real-time metrics analysis.
- New Relic: A comprehensive performance monitoring and analysis tool that provides insights into application performance, infrastructure monitoring, and real-user monitoring.
Interpreting performance test results:
Performance test results provide crucial insights into system behavior. Key aspects to consider when interpreting performance test results include:
- Response time analysis: Analyze the distribution of response times and identify any outliers or performance bottlenecks.
- Throughput analysis: Assess the system’s capacity to handle concurrent requests and determine if it meets the required throughput targets.
- Error analysis: Investigate the error rates and identify any patterns or common failure scenarios that require attention.
Performance Optimization:
Identifying performance bottlenecks and areas of improvement:
- Profiling: Use profiling tools to identify sections of code or system components that consume the most resources or exhibit slow performance.
- Monitoring: Implement performance monitoring tools to gather real-time data on system metrics and identify areas of performance degradation.
Techniques for optimizing system performance (e.g., code optimization, database tuning, caching):
- Code optimization: Identify and optimize inefficient code segments or algorithms to improve their performance. This can involve techniques such as algorithmic improvements, reducing redundant computations, or optimizing data structures.
- Database tuning: Optimize database queries, indexes, and configurations to improve data retrieval and storage performance. This includes analyzing query execution plans, indexing strategies, and database schema design.
- Caching: Implement caching mechanisms to store frequently accessed data or computed results in memory, reducing the need for expensive computations or database queries. This can involve using in-memory caches, content delivery networks (CDNs), or application-level caching.
Vertical and horizontal scaling as performance optimization strategies:
- Vertical scaling: Also known as scaling up, it involves increasing the resources (such as CPU, memory, or storage) of an individual server or instance to handle increased workload. This can be achieved by upgrading hardware components or migrating to more powerful servers.
- Horizontal scaling: Also known as scaling out, it involves distributing the workload across multiple servers or instances to handle increased traffic or demand. This can be achieved by adding more servers to a cluster or using load balancers to distribute requests.
Monitoring and Alerting:
Implementing performance monitoring and alerting systems:
- Instrumentation: Integrate monitoring tools and libraries into the system code to collect relevant performance metrics, such as response times, resource utilization, and error rates.
- Logging: Implement detailed logging mechanisms to capture system events, errors, and performance-related information for analysis and troubleshooting.
Setting up performance thresholds and alarms:
- Define performance thresholds: Establish baseline performance metrics and set thresholds for various key performance indicators (KPIs). These thresholds define acceptable performance levels and deviations that require attention.
- Configure alerting: Set up alerting mechanisms that trigger notifications or alarms when performance metrics breach predefined thresholds. This enables proactive identification and resolution of performance issues.
Analyzing and interpreting performance monitoring data:
- Data visualization: Use data visualization techniques, such as graphs, charts, or dashboards, to analyze and interpret performance monitoring data. Visual representations make it easier to identify trends, patterns, or anomalies.
- Comparative analysis: Compare current performance metrics with historical data or predefined targets to assess performance trends, identify improvements, or detect regressions.
Performance Best Practices:
Design principles and best practices for high-performance systems:
- Minimize network round trips: Reduce the number of network round trips by optimizing data transfer, leveraging techniques like batching, compression, or using efficient protocols.
- Asynchronous processing: Utilize asynchronous processing and non-blocking I/O operations to maximize system concurrency and responsiveness.
- Caching strategies: Implement effective caching mechanisms at different layers, such as application-level caching, database query caching, or content caching, to reduce expensive computations and data access.
Optimizing network communication and data transfer:
- Use efficient data formats: Opt for compact and efficient data formats, such as JSON, Protocol Buffers, or MessagePack, for network communication to reduce payload size and minimize bandwidth usage.
- Compression techniques: Apply compression algorithms, such as gzip or deflate, to compress data during transmission, reducing network bandwidth requirements.
Scalability and performance considerations in distributed systems:
- Distributed caching: Utilize distributed caching systems, such as Redis or Memcached, to improve performance and reduce data access latency in distributed environments.
- Load balancing: Employ load balancers to distribute incoming requests across multiple servers or instances, ensuring even workload distribution and improved system performance.
- Partitioning and sharding: Divide data and processing tasks into smaller partitions or shards, distributing them across multiple nodes or clusters to achieve scalability and parallel processing.
That’s it for now!
Read Part 10 of Complete System Design Series
Keep learning and coding :)
Day 2 : SQL Basics, Query Structure, Built In functions Conditions
Day 4 : Set Theory Operations, Stored Procedures and CASE statements in SQL
Day 6 : Subqueries, Group by, order by and Having clauses in SQL and Analytical Functions
Day 7 : Window Functions, Grouping Sets and Constraints in SQL
Day 8 : BigQuery Basics, SELECT, FROM, WHERE and Date and Extract in BigQuery
Day 9 : Common Expression Table, UNNEST Clause, SQL vs NoSQL Databases
Day 10 : Triggers, Pivot and Cursors in SQL
Day 14 : MySQL in Depth
Day 15 : PostgreSQL inDepth
Anyways, For Day 15 of 15 days of Advanced SQL, we will cover —
PostgreSQL inDepth
Github for Advanced SQL that you can follow —
All the projects, data structures, algorithms, system design, Data Science and ML, Data Engineering, MLOps and Deep Learning videos will be published on our youtube channel ( just launched).
Subscribe today!
System Design Case Studies — In Depth
Complete Data Structures and Algorithm Series
Github —
Some of the other best Series —
30 days of Data Structures and Algorithms and System Design Simplified
100 days : Your Data Science and Machine Learning Degree Series with projects
Complete Data Visualization and Pre-processing Series with projects
Tech Newsletter —
If you are interested, you can join my newsletter through which I send tech interview tips, techniques, patterns, hacks — Software Development, ML, Data Science, Startups and Technology projects to more than 30K readers. You can subscribe to Tech Brew :
For Python Projects —
For complete 60 days of Data Science and ML : Day 1 — Day 60 : Quick Recap of 60 days of Data Science and ML
Follow for more updates. Stay tuned and keep coding!
For other projects, tune to —
Build Machine Learning Pipelines( With Code)
Recurrent Neural Network with Keras
Clustering Geolocation Data in Python using DBSCAN and K-Means
Facial Expression Recognition using Keras
Hyperparameter Tuning with Keras Tuner
Custom Layers in Keras





