System Design
System Design
databases
Caches
Search indexes
Stream processing
batch processing
We may need to combine different tools together so we can find best matches for our application ,
because everything provide different characterstics
for so many requirement, a single software cannot meet all the requirement, so a single system is
focused on performing the task and these software are stitched together using code.
using different software for cacheing and searching and stiching them together
screenshot
How to mainatain the data correctly if something goes wrong, this is aslo task of system designer
Reliability
The system should continue to work correctly (performing the correct function at the desired level
of performance) even in the face of adversity (hardware or soft‐
ware faults, and even human error).
Scalability
As the system grows (in data volume, traffic volume, or complexity), there should
be reasonable ways of dealing with that growth
Maintainability
Over time, many different people will work on the system (engineering and oper‐
ations, both maintaining current behavior and adapting the system to new use
cases), and they should all be able to work on it productively.
Reliability :
1. User Expected Performance
2. able handle cases where user make unexpected mistake or error
3. unauthorized acces and abuse -> prevent
things go wrong is fault and the system that cops with this is falut tolerant and resilent.
Hardware faults
software errors :
when these faults happen, in before faul software is making judgement about its surrounding and it
faults happem then it stop becomming true;
human error :
we make the mistake even our best intenstion , it happen mostly because of us , so what to do to
avoid this :
2. decouple the places where most mistake happen and provide sandbox enviornment where user
can experiment on their own
3. testing thoroughly at all level using unit testing to whole system integration
4. allow quuick and easy recovery from human errrors, to minimize the impact in the case of a
failure and make it easy to rollback changes
5. set up clear and detailed monitoring system
6. implement good management practices and training .
Importance of reliability :
reliabilty matters. but can be scarificed acc. development needs. but we should be very councious
when we are cutting corner
Scalability
scalability
working reliable today doesn't mean working relaible tommor, main reason degradation due to
increase load
scalability -> system capability to cope with load
if sytsem grow in particular way what are our option of coping with the load
Describing load
Describe perfromance
1. when load is incereased and all the parameter is kept same, see how it affect the system .
2. when u increase the performance , how much u needed to keep the performance same
we don't use mean of response time as a percentile because it doesn;t tell us how many user actually
experienced the delay, but use percentiles
median is good measure of, now think own of won why its is good metric
an
effect known as tail latency amplification
figure
Appraoches for coping load
how do we maintain good performance when our load parameter increases by some ammount
scaling up -> vertical scaling -> increasing the specs of current machine
scaling out -> horizontal scaling -> distributing the load across multiple system. -> it is also known
as shared-nothing architecture.
for database that has state -> its common knowlegde to use scale up ubtill scaling cost is high
forced us to make it distributed.
for app. that has large scale is usally highly specific to the application, there is no such thing as a
generic, one size fit all scalable architecture -> magic scaling sauce
which load parameter will be common and which will be rare,l eads to development of architecture
Maintainability
majority of cost goes into ongoing maintenance -fixing bugs, keeping its systems operational,
investigating failures, adapting it to new platforms, modifying it for new use cases,
repaying technical debt, and adding new features.
legacy system-> oudated system that is outdated system that is still in use .
should write code in such way -> that reduces cost of maintainig it to minimilast
2. simplicity :
make it easy for new engineers to understan the system, by removind as much complexity as
possible from the system
3. Evolvability : make it easy fo engineer to make change to the system in the fututre, adapting it
for unanticipated use cases as rquirement change -> ectensility, modifiability or plasticity.
operability : making life easy for operations
responsibility of operation
*moitoring the health of the system and quickly restoring service if it goes into a bad state
*tracking down the cause of problem , such as system failure or degraded performance
Good operability
There are various possible symptoms of complexity: explosion of the state space, tight
coupling of modules, tangled dependencies, inconsistent naming and terminology,
hacks aimed at solving performance problems, special-casing to work around issues
elsewhere, and many more.
Making a system simpler does not necessarily mean reducing its functionality, it removing
accidental complexiciyt
moseley and marks define complexiity as accidental if it is not inherent in the problem that problem
that software solve but arises only from the implementation.
Evolvalibity
agile communtiy developed tool for maintiang the tdd and refactoring