System Design Concepts
System Design Concepts
MASTER
DESIGN
interviews.
www.bosscoderacademy.com 1
Question-1
www.bosscoderacademy.com 2
Adding more shards scales the database as the user base
grows.
www.bosscoderacademy.com 3
Question-2
www.bosscoderacademy.com 4
Question-3
becoming unavailable
Ex:RDBMS(Oracle SQL Server MySQL)
Ex: MonogoDB Hbase
www.bosscoderacademy.com 5
Question-4
Cassandra, MongoDB,
Ex amples Google Cloud Spanner
MySQL and Amazon RDS
www.bosscoderacademy.com 6
Fundamentals Horizontal Scaling Vertical Scaling
As it entails distributing It involves the Actor model:
jobs among devices over a Multi-threading and in-
network is known as process message
Concurrency distributed programming. forwarding are frequently
Several patterns are used to implement
Models connected to this model: concurrent programming
MapReduce, Master/ on multi-core platforms.
Worker*, Blackboard, and
many spaces.
Data sharing is more
difficult in distributed Data sharing and message
computing because there passing Can be
Message isn’t a shared address accomplished by passing a
Passing space. Since you will send reference in a multi-threaded
copies of the data, it also scenario since it is
increases the cost of reasonable to presume that
sharing, transferring, or there is a shared address
updating data. space.
www.bosscoderacademy.com 8
Question-6
www.bosscoderacademy.com 9
Statelessness Requirement:
SOAP: No.
REST: Yes.
Security Level:
SOAP: Preferred for high-security needs.
REST: Security depends on underlying implementation.
Transaction Support:
SOAP: Provides advanced support for transactions.
REST: Limited transaction support.
Bandwidth/Resource Usage:
SOAP: High bandwidth due to XML data overhead.
REST: Uses less bandwidth.
Development and Maintenance Ease:
SOAP: More complex.
REST: Known for simplicity, easy development, testing, and
maintenance.
www.bosscoderacademy.com 10
Question-7
Types of CDNs:
Pull CDNs:
Edge servers fetch content from the origin server upon user
request.
Suitable for content with low update frequency or high
demand spikes.
www.bosscoderacademy.com 11
Push CDNs:
Content proactively pushed to edge servers, ensuring
immediate availability.
Ideal for dynamic content that changes frequently or has
high peak periods.
www.bosscoderacademy.com 12
Question-8
Sharding:
Definition: A specific type of horizontal partitioning where
data is distributed across multiple separate servers.
www.bosscoderacademy.com 13
Location: Each partition (shard) resides on a dedicated
server.
Benefits: Excellent scalability, high availability, faster query
execution due to true parallelism.
Drawbacks: Increased complexity, potential data
consistency issues, higher infrastructure costs.
www.bosscoderacademy.com 14
Question-9
www.bosscoderacademy.com 15
5. Throughput: This measures the number of requests or
operations your system can successfully process per unit of
time. It's often expressed in requests per second (RPS) or
transactions per second (TPS). High throughput ensures the
system can handle large volumes of users or data.
www.bosscoderacademy.com 16
Question-10
2. Strong Consistency:
Reads always reflect the latest write, meaning data is
replicated synchronously across all servers.
Provides strict consistency but sacrifices scalability and
performance.
www.bosscoderacademy.com 17
Used in systems like databases and filesystems where data
integrity is crucial.
3. Weak Consistency:
Focuses on fast access, allowing reads to potentially see
outdated data.
No well-defined rules for data updates, so different servers
might return different values.
Used in real-time applications like VoIP and video chat
where speed is prioritized over absolute data accuracy.
www.bosscoderacademy.com 18
Question-11
User Experience:
Apdex Score: Blends response time and success rate for
user satisfaction.
Average Response Time: How long it takes the system to
answer user requests.
System Health:
Throughput: Number of requests handled per unit of time
(helps determine scaling needs).
Availability/Uptime: Percentage of time the system is
operational.
Error Rates: Frequency of errors encountered during
operation.
Resource Utilization:
Latency & CPU: Monitors data transfer speed and CPU
usage to identify bottlenecks.
Garbage Collection: Tracks memory management
efficiency.
www.bosscoderacademy.com 19
Others:
Database Performance: Monitor key database metrics for
optimal operation.
Network Performance: Track bandwidth, packet loss, and
latency for network reliability.
Security Metrics: Monitor events and access controls for
system security.
www.bosscoderacademy.com 20
Question-12
Write-around:
Writes bypass the cache and go directly to the database.
Pros: Potentially lower write latency.
Cons: Increased cache misses, leading to higher read
latency for frequently written and re-read data.
www.bosscoderacademy.com 21
Write-back:
Writes occur only in the cache, confirmed immediately. Data
is asynchronously synced to the database later.
Pros: Lower write latency, higher throughput for write-
intensive workloads.
Cons: Risk of data loss if the cache crashes before syncing.
Improved reliability with multiple write acknowledgements.
www.bosscoderacademy.com 22
Question-13
www.bosscoderacademy.com 23
Ordering: Delivers messages in sender's order, ensuring each
message is received at least once.
Task Queues: Executes tasks in the background, supporting
scheduling and intensive computations.
www.bosscoderacademy.com 24
Question-14
www.bosscoderacademy.com 26
Question-16
www.bosscoderacademy.com 27
Question-17
Token Bucket:
Requests require tokens
from a bucket for processng.
Refuses requests if no tokens
are available, refreshing
the bucket over time.
www.bosscoderacademy.com 28
Fixed Window:
Uses a fixed time window
to track request rates.
Requests exceeding a
threshold within the window
are discarded.
Sliding Log:
Uses a fixed time window to
track request rates.
Requests exceeding a
threshold within the window
are discarded.
Sliding Window:
Combines elements of fixed
window and sliding log
approaches.
Tracks request rates for each
fixed window, considering
weighted values from previous
windows for smoother traffic handling.
www.bosscoderacademy.com 29
Question-18
www.bosscoderacademy.com 30
Question-19
Advantages of Microservices:
Agility and Speed: Faster development and deployment
cycles due to independent services.
Scalability: Individual services can be scaled up or down
independently based on demand.
Resilience: Failure of one service doesn't cripple the entire
app.
Technology Choice: Each service can use the best tool for
the job without affecting others.
www.bosscoderacademy.com 31
Disadvantages of Microservices:
Complexity: Increased overhead in managing infrastructure,
communication, and monitoring.
Testing: Testing complex distributed systems can be
challenging and time-consuming.
Debugging: Identifying and fixing issues across services can
be difficult.
Cost: Initial setup and ongoing maintenance can be more
expensive than monolithic.
www.bosscoderacademy.com 32
Question-20
www.bosscoderacademy.com 33
High scalability and performance are primary concerns:
You anticipate significant data growth and require rapid
read/write operations. NoSQL often scales horizontally,
adding more servers to handle increased load.
Data consistency trade-offs are acceptable: Your
application priorities might emphasize speed and availability
over absolute data consistency.
www.bosscoderacademy.com 34
Why
Bosscoder?
750+ Alumni placed at Top
Product-based companies.
Explore More