Skip to main content
Open navigation menu
Close suggestions
Search
Search
en
Change Language, English
Upload
Sign in
Sign in
0 ratings
0% found this document useful (0 votes)
22 views
32 pages
System Design
Uploaded by
26mohit102002
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save System Design For Later
Share
0%
0% found this document useful, Mark this document as useful
0%
0% found this document not useful, Mark this document as not useful
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
22 views
32 pages
System Design
Uploaded by
26mohit102002
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Go to previous items
Download
Save
Save System Design For Later
Share
0%
0% found this document useful, Mark this document as useful
0%
0% found this document not useful, Mark this document as not useful
Print
Embed
Report
Go to next items
Download
Save System Design For Later
Share
More options
Fullscreen
I 1): |Txy r0_bxeak -the problem into simplex Modules - | (Top down approach _) 2): Talk about the trade - Offs. CNo solution is perfect) _ [Calculated based on all tthe consfyaints and +ne end test cases Ask uestions « Consteainfs | & Punctionaltty inding _& | Requliement’s ) laddvessin9 bottlenecks TRatlonalize ideas and inputs e Aychitectural Pieces / yesources avatiable © How these wesources work +o9ethey. © Utilization & Thade off.| lion Cz i in CAP THeovem toad balancing Queues Cachin Replication SQtL_vsNo- SAL Indexes Proxies Data Paxtitioning . C Distributed system) evi os (eum Random: = i Round = xObin — Random ( weignts Fox _____mMemoty & cpu cycles) Mo utilize Fu Scalability & ¥edundancy , add 218. ue 1) User EBL» Web server 2) |Web SewergebB2 , App Sever / cache cower (Intemai larform. 3: \Tnpesnal platform -B3 _. peTdke a pool of sewvices hosts & balance load —_—? detect hosts thet ave not xesponsible __— |\yecovered hosts ree ais 9 —> |addition of new hosts : nie a Load balancing Func ctlonaiity 1D Ds (Cache e Services ) ang # Artractive Solution for developers. (Small scale system) _ LAs System a —> LBs ( Standalone Sewers). “Expensive but high Setanta 2-9. Citrix Netscaley | Not trivial tp Configure eng Large Companies tend to avoid tnis_ Contig. OX use it as 4 peint oF contact to thely Syste: jtoSeWwve _usey request & Thtva network uses | | smart clients/ hybrid Soiution = eee | Fox load balancing tvaefic.= pz: No cost of purchasing dedicated Hardwase. hybrid approach. ,_=P_OSS Load balancess H : (CLocatly bound pox 2-9. localhost: 9900 ; = manage. d_by HAPyoxy i FFicient management | i of vequest on the port) — Running, on intermediate server. | Peoxies yunning, between different sexvey side iCcomponents Manages health checks temoval & addition of machines balances vequests alc pools.er ASTES Structured je] Unstructured Predefined schema je | distyibuted Data, in vows £crJumn| lel dynamic Schema Row > One Entity Info _ Column => Sepasare "dara points key-value stoses on __[= Document DB = My 5aoeee wide-(olumn 08 Ovacle Ms SAL Sexver S@vite Postases MariaDB> array OF key -Value poly Key > attribute Oe inked to Dara whose xelati Ons axe best sepr4 =sented in Graphs 2 Nodes (Entities) > Lines Cconnection CInstead of tables, Columns, Families. _ alo need of know oF columns Analysis of large datasets.el difference: een SG NoSB.L Nos@t Tables CRow — Entity, Column Data Ons . a ette1). | You need to ensure ACID Compliance + AcID_ Compliance => Reduces anomalies => Protects Intigrity of the database. || Fox many & - Commerce & Financlal_application —__ ACID Complaint DB is the_ Eivst choice. saireeies _2). | Your _data_is structused & unchanging. TP your business. is not’ experiencing vapid aQxouth evo sudden changes= = ess __ =D_No_vequivements of mote Sexvers ._ | => _data_is consistent. | then there's no yeason_to_use System Desian _| +0 Support vasiety of data £ high tvaftic._ BTL Koma! When all other Components of system aye fast | quan lae _& seayching for data > bottleneck. NoS&L prevent data from being bottleneck. ____| Big data => large Success for nlos@l. 1). Tb * stove jarge volumes of data (1ittle | no ; Styucture) No Umit on type of data. aor we |Document DB => Stoves all data in One place _| C No need of type of data)} 2) Using cloud & storage to -the fullest . [excellent cost coving solution. Easy spsead oF | data acyoss multiple Sexvers to Scale up). (OR commodity b/w on site Caffoxdable, smaiier) (=> No headache of additional s/v . |& Noger DBs like cassandra > designed +o Scale acyoss multiple data centers our 8 eo ies). |Usefur_ Fox xapid | agile development. TF you've makin ick Ttevattons on down. iby updating [Consistency] ( Ail nodes see same several nodes before _data_at same time) allowing xeads — Ne, . %. ty ya, COUChDB) & |Evety sequest ets yesponse : .4 \Csuccess/ Failure) System continues to work despite ___ message loss/ partial BQol\ures a 9.Achieved by replicating ¢ can_ sustain any data across diffexent amount of nemotk Sexvess Failure without vesuiting in Foiluse of entive network. ) Data is sufficiently, xeplicated across combination of nodes Networks to Keep the System up. Th is impossible fora distributed system to i oo +tto_oF ite cannot_build-a da tastoxe which is : > Continually available mi - | Sequenti ally Consistent : gut women Lantern) ieee FoSluve tolerant. E Because , To be Consistent =S> all nodes should see the Same set of updates in -the I Same order. _ ‘But i€ network suffers Partition, updote in one partition might not make it to other partitions. G chient reads data From out-of-date partition After having xead up-to-date _ vHton + Sclution, Stop serving vequests yom out-of-date artiton - e : > Service is no longer LOO. available.|Duplication of critical data & Sexvices . incseasing yeliability of system. |Pox critical services Ye data => ensure that multiple icopies] versions axe yunning stmulpaneously on _ different Sewers | databases. | => Secuxe against single node Failures. i Psovides backups if needed in cyisi Failover a4 i ‘ es Server Secondary Sesves. __ =— oe i a — = = Active dato cf > mma : HE Sewice Redundancy? Shaved - nothing, | architecture . Every node > Independent. nlo centyal sevice | __________ Managing state. | More resilient +o Follures a New Servers <— Helps In addition Without Scalavility, A single points - condiHons of Failuge hee|Lead balancing > Scales horizontally [Caching ? Locality of refetence principle & used tn almost every layer of computing Le cation Server cache : Placing a cache divectty on a yeqiest layex node- & Loca! nr of f ceapente Request | ter es ee =| ae Z iE hit. te | ree cae ie missie . sesponse data nodes loca disk. ___( faster than going to_network storage) LB distvibutes request yandoml| Same sequest => cieferent nodes More cache nuiss 2 2 )._ | Global caches 2). | Distvibuted cachesOra 1-2 size eee Divided using, consistent_hasting function sesult ___in Fast tetvieval oF data CRE oT Quex ttt Easy to Incvease cache space by adding Mote nodes. __ ~ ‘ te 4 Disadvantages : ‘Ixesolving a missing node . stasting multiple copies of «can be data on different nodes. handled by Were making tt more I a complicated - art: Even if node disappears = xequest can pull data from Origin. ecu —_ | Single cache space foy all the nodes. Adding a cache sewers / File store ( Faster -than Original store ) AE | DiFficult to manage if no Clients f request incteases - A BS —ve Fixed dataset that needs +0 be cached Special Hw => Past 1/0 Database cache ih to bring ne ——d ata -from-database- _ Contain hot data sets. __ Database | Application I logic undeystands the styategy | hot spots better than cathe. 5 istyibution Ca Stove Fox Sites -that seyves lavge amount of stahc medio e Back-end TF not avaljable bSeNEsTF the site isn't layge enough to have Its own _ CDN. For better & easy Futuse tyansition. | .... Is Wwe static media _using separte subdomain. | Static. [Link] 7 Using lightweight Ngl\nx Serer | cutover DNS From your server TO CDN later. u __ HE Cached data Needs to be Caherent wlth the i a datobosci meme ey i UIP data in p& modified > invalidate the cache Data ts written same time in both Cache 2 DB Lt Complete data consistency € cache = D8) _ ++ Poult tolerance tn case of failure C1 data los i— high latency in writes > 2 write operations:+ No cache | for wirrites — yead er re for ee wiitten data > Miss higher Ene 8). rite back cache: [Cache] I Roa "after same taterval “yesponse i client ey under same specified — conditions data is wisitten +e DB F¥OmM Cache - + tow latency % high +threughout fox waite - intensive application . = Data toss 1 Conly one copy tn cache) 4e = Cache Eviction Policies EIFO igo ov FILO | Leu MRU LEU[Data Partitioning, « Splitting up De/table across Multiple machines > manageability , performance, availability Fe LB i We Acrex a certain scale point, it is cheaper and more feasible to scale horizontally by adding more Machines instead of Vertical Scaling by adding buffers Services. Methods of Pastitionin i 1)- Horizontal Partitioning : Different sows lato dife. sis eeecoblese “Sy = Sie s Range based shayding = Storing location | Oble 1: Zip Table2: Zip with > 106000 and soon. zi i ~ different yanges Pine Indie feyent — +abes. x Cons: if tne value of the vange not chosen carefully => leads to Unbalanced seyvers, |_e-9-Table 1 can have move data than table2. | : at | Featuve yilse distyibution of data. Ly in different sevvers . oes eg: = Sevvevt: user info _| i DR Server 2: fpilowess IDB Seves.s : uifehotossStraightforward +o implement | 1OW impact on app. iF Appradditeonal growth Need +0 Partition Featuse specific DB across various Sexvers- (e-9. tt would not be possible Fora cingie sexver to handle all_ metadata quaries for 10 miilion Phetos by 140 millions users. A loosely coupled approach to work axound Issues _mentoned in above two paytittonings. Cieate lookup sewices =P current partitioning kcheme & abstyacts it away, from -the DB access code. Mapping Ctuple key — DB Sexver ) Easy +0 add DB sewers O% change paytitioning Scheme. Key ov Hash based Parti oning * key atty. oF 5} Hash function Partiton te data number ae Effectively Fixes the -total number of sexvers / | Partition *, = |So tf we add new server | pastition Change In hash functton downtime because of sedistsi bution . tH, List axtitioning : Each Partition 1s assigned a ist of values . —> tore the vecord (Partition based on Round Retin Farttoning : uniform data distsibution - with | n_’ partitions >the‘ |? tuple ts assigned to Partition (1 moa n _ Composite ‘astitioning : Combination of above vtitioning schemes Hashing + List => Consistent Hashing Hash veduces the Ixey space to a size that can be listed._= |Common Problems of Shayding * Shayded DB: Extya Constraints on -the different operations Operations acvoss multiple tables ox multiple yows in the same “table - No longer yunning in : ___Single_ server. 1): Joins £& Denoxmalization t Joins en tables on Single server? Styeignt __ t! hh ___ forward. * not possible +0 pevform jeins on standard +tables & Less efficient (data need 40 be compiled 7 ______fiom_multiple sewers) FE Workaround > Denoymatize the DB. So that -the quarsies -that previously yeqd- jolns can be performed from a single -tabie- Cons: Perils oF denormalization. data incensistency- ‘Referential Integrity : foreign Keys on Sharded D8. | AlFfeult. * Most of the RDBMS does not support foreign Keys on Sharded DB. ae TF app” demands veFevential integrity on, Sharded DB. | > enforce It In svat a C sau jobs | 40 clean up dangiing yeference)- 53) | ‘Rebatancing id ‘Reasons +o change Shayding scheme : a): | non-uniform distribution Cdata Wise) b)- Inon- uniform load balancing (request wise) Woykayound +_1):|Add new OR 2) | yebalanw © Change in partitioning scheme = data movement. G downtime. We can use Gixecty — based partitioning, > hignty complex in & Single polnt oF Fallure Clookup service | pyul pen =? Well Known because of database. => Impzoves Panter to whne yaw> [Create different views of the same datn & Vesy quod for Fitering| sorting of large data sets. Gino need to create additional copies. Using Fox datasets Ge in Size) & Smau payload Spyead over Several saat C ks). Physical devices. — > we need some way +o Find the correct physical location. j-e- [ Peoetes > user under high load situations. if we have limited Caching - L, batthes several requests {nto one. Servey Proxy : Server Filters request log yequests [Cache | y. add/remove headers Freqyentiy used encryption /deayption yesources., Compresston. vequest co-ordination Crequest rat ic Optimization )eee 4 We can a)so use @— Collapse same dataaccess Spottal locality sequest Into_one- & Collapsing vequest > Collapsed Forwarding fox data -that is Sprtially cluse. Minimize veads From Oxioin- > Effectively manages xequests In_laxqe-scale distributed system. => In Small system —9 pyifes ove Fast > Tn Compiex system —? high incoming load. &individual vurites take ue morte time. * Te achieve high performance & anol lala ltty Ly sustem needs to be asynchymeus ueue de Synchsmaus behaviour —> degrades performance aigPicutt For forx can reees Co scid LZ batancin9 distribution.FE | Queues » asynchrmaus Communication protoco). Client sends task & get Ack Fromqpeue Geceipt) Server as sefrenus for the wesults In Future . Ciient continues Hs work. 3 Limit on-the ize of xequest % number of xequests tn Queue SE (COQueue + Provides fouit totevane. ‘ ____& Protection From _cowice Outage / failure. highly yequest —_ bes 7 yotru fo! luye service yequest Enfo: yvices, qurantee (Dees NOT expose clients outage) ZE (Queues. distyibuted Communication b& Open Sousce \mplementatin. Ly RabbitmM@, Zerom@, active, Beanstak D- Distributed fash -pables Index = hash - Function (key)— aE Suppose were designing distvibuted caching - system wlth n cache serulces G hash- Function > (key tn ) Dyawbacks : 1): NOT horizentaily scalable L> addition of new sewers yesults In Ls needs +0 change all existing, mopping, - : Cdowntime of system ) 2). N6T load balanced _ ee _( becouse of non - uni distribution of data) — Some caches: hat 2 satwated __other caches : idle @ empty °_ Hom to tackle above pyublems? — ea isten hi a ao ¢ What is consistent_tHashing ? > \ery useful stvateqy for distvibuted caching &~ DHTs. ae ee > Minimi eorganization jn scaling up| down. __ only Keys needs to be yemapped . K= tora numbers of Keys N= number of Sewers Pre © | How it works? fe. = Typteal aa Suppose outputs i 5 One ——An consistent hashing, [imagine all of -these integers aye placed on a 3ing. 7192-24 7 * a / c & we have % Sewers : A,B LC ven a list ©F Servers , hash -them +o Integeys in’ ag vongel. ae 2854-0 = @ (AY 2) Map key 40.4 server: a), Hash it +0 single integey b): Move clockwise unt] you find server ©). Mop Key to that server. |h(Key-1) A h(key-2) Adding a new server _D Will xesult in moving, the Key-2 {> "D*. ls ‘Removing Server ‘A’ willl yesult in moving -the ‘Key-)' to 8’, 255.40 hixeg-12 © Q SS_Consides ye@l world Scenario data — yandomly distributed Unbalanced caches. How +o handle +his issue ? tytual 4 i => ‘Instead of mapping each node tp o single pelnt we mop fr to oultipie peints. seem S( move number of Yeplicas _ Ls more equal distvibution —__________Lrayeod load balancing) |u& Client - Sevver Communication Protocols . inet SR Fe ceaaay— 4 HTTP Protocol : ccummme, Wiss.” Request Prepare“Response 4 ATAX Polling Clients vepeatedly polls sewers for data Similoy +p ITP Protocol Ly vequest sent to Server at xequlay, Intewals (0-5 sec) 2 42, whacks + Client Keeps asking the seyvvey new data Ly Lot of response ave Sempty’? _ L, HTTP Overhead .Rey est eee ¢ “tespanse |S Resuest z 1 Ee nee £ Rexpare| T Repiest z __— — 2 Response 4+ HOP Lag Pouings “Hanging GET? Sewer does NOT send empty yesponse . Pushes vesponse {> clients only when new data is available .— )- Client makes HTTP Request 2 waits for the LESPONSE - 30Ick request € : full response ur xeques an ——_» < —— full _Yesponse UPpyequest ; to —_—— Pauly yes ponse —_ Exnduplex communtcation chanel! over single TCP Connection, — Provides ‘ Persistent communication’ Celtent & sesver can_send data at anytime ) — bidirectional communication is alwoys open channel: Handshake Success Yesponse. ar — Ses Spenbianiedonal ——_ Communication $$$» channel > Lowey Overheads. > Real Hime dato-tansfer-Client’ establishes persistent % long -texm connection with seryvey Sexvey_ uses -this connecHon +o send data to client *x (TE cient wonts +o send data to server G Requives another tedhnclogy | protecel. data yeqwies: using vegulay HTTP == Saree open ee (28 communica: — seem wesponses whenever new data asjaljable —> best when we need yeal-time data from server +o cllent OR server is geneyating dato in a Jone & will be sending multple events to the Client.
You might also like
? System Design ? (Handwritten) Notes
PDF
No ratings yet
? System Design ? (Handwritten) Notes
27 pages
Load Balancing Strategies at Directi
PDF
No ratings yet
Load Balancing Strategies at Directi
73 pages
System Design Interview 01 Scale From Zero To Millions of Users
PDF
No ratings yet
System Design Interview 01 Scale From Zero To Millions of Users
1 page
Scaling Systems for Millions of Users
PDF
No ratings yet
Scaling Systems for Millions of Users
21 pages
DD Unit1
PDF
No ratings yet
DD Unit1
38 pages
URL Shortener Microservice Design Guide
PDF
100% (1)
URL Shortener Microservice Design Guide
32 pages
NoSQL Data Management Techniques
PDF
No ratings yet
NoSQL Data Management Techniques
27 pages
Scaling from Zero to Millions of Users
PDF
No ratings yet
Scaling from Zero to Millions of Users
40 pages
The System Design
PDF
No ratings yet
The System Design
135 pages
MySQL Scaling and High Availability Architectures
PDF
100% (8)
MySQL Scaling and High Availability Architectures
57 pages
Guide to Designing Scalable Systems
PDF
No ratings yet
Guide to Designing Scalable Systems
56 pages
System Design Concepts and Strategies
PDF
No ratings yet
System Design Concepts and Strategies
146 pages
Consistent Hashing vs Sharding Explained
PDF
No ratings yet
Consistent Hashing vs Sharding Explained
4 pages
Introduction to Distributed Systems
PDF
No ratings yet
Introduction to Distributed Systems
31 pages
SQL Server Scaling Techniques Explained
PDF
No ratings yet
SQL Server Scaling Techniques Explained
41 pages
Elastic Scalability in Cloud Services
PDF
No ratings yet
Elastic Scalability in Cloud Services
63 pages
Arch Ges
PDF
No ratings yet
Arch Ges
10 pages
02 Scalability
PDF
No ratings yet
02 Scalability
7 pages
Cracking the System Design Interview Guide
PDF
100% (3)
Cracking the System Design Interview Guide
91 pages
Optimizing Data Access in Distributed Systems
PDF
No ratings yet
Optimizing Data Access in Distributed Systems
253 pages
Scaling Web Apps for Millions of Users
PDF
No ratings yet
Scaling Web Apps for Millions of Users
8 pages
Cloud Data Management Strategies
PDF
No ratings yet
Cloud Data Management Strategies
79 pages
Unit 2
PDF
No ratings yet
Unit 2
49 pages
NoSQL Database Overview and Concepts
PDF
No ratings yet
NoSQL Database Overview and Concepts
40 pages
System Design HLD LLD Guide 2026
PDF
No ratings yet
System Design HLD LLD Guide 2026
18 pages
System Design Insights by Rocky Bhatia
PDF
No ratings yet
System Design Insights by Rocky Bhatia
11 pages
Enhancing Hadoop MapReduce Observability
PDF
No ratings yet
Enhancing Hadoop MapReduce Observability
72 pages
Cloud Data Management Challenges
PDF
No ratings yet
Cloud Data Management Challenges
10 pages
DSAI4202 Introduction Lecture02
PDF
No ratings yet
DSAI4202 Introduction Lecture02
64 pages
Understanding Cloud Computing Basics
PDF
No ratings yet
Understanding Cloud Computing Basics
9 pages
Scaling Systems for Millions of Users
PDF
No ratings yet
Scaling Systems for Millions of Users
28 pages
Web System Design Fundamentals
PDF
No ratings yet
Web System Design Fundamentals
5 pages
Lessons from Building Google Systems
PDF
100% (3)
Lessons from Building Google Systems
73 pages
System Design Concepts and Techniques
PDF
No ratings yet
System Design Concepts and Techniques
128 pages
Big Data Scalability and Architecture Insights
PDF
No ratings yet
Big Data Scalability and Architecture Insights
91 pages
Big Data Concepts and Data Engineering
PDF
No ratings yet
Big Data Concepts and Data Engineering
3 pages
Big Data Scalability and Architecture Insights
PDF
No ratings yet
Big Data Scalability and Architecture Insights
88 pages
DMassignment1 34
PDF
No ratings yet
DMassignment1 34
14 pages
Introduction To Distributed
PDF
No ratings yet
Introduction To Distributed
51 pages
Chapter 1 Contd..
PDF
No ratings yet
Chapter 1 Contd..
31 pages
System Design Part 1
PDF
No ratings yet
System Design Part 1
17 pages
NoSQL Data Modeling Techniques
PDF
No ratings yet
NoSQL Data Modeling Techniques
21 pages
02 Scaling
PDF
No ratings yet
02 Scaling
7 pages
Imp Notes Adbms
PDF
No ratings yet
Imp Notes Adbms
18 pages
Understanding Database Scalability Options
PDF
No ratings yet
Understanding Database Scalability Options
11 pages
Architectural Concerns in Distributed Systems
PDF
No ratings yet
Architectural Concerns in Distributed Systems
12 pages
BDA Module3
PDF
No ratings yet
BDA Module3
54 pages
Foundations of Big Data Systems
PDF
No ratings yet
Foundations of Big Data Systems
44 pages
HPC vs Cloud Computing Explained
PDF
No ratings yet
HPC vs Cloud Computing Explained
35 pages
Database Distribution Models Explained
PDF
No ratings yet
Database Distribution Models Explained
25 pages
Cloud Management 2
PDF
No ratings yet
Cloud Management 2
12 pages
Understanding Remote Procedure Calls and Protocols
PDF
No ratings yet
Understanding Remote Procedure Calls and Protocols
2 pages
Design Systems for 100M Users
PDF
No ratings yet
Design Systems for 100M Users
34 pages
LiveJournal Backend Evolution Overview
PDF
100% (3)
LiveJournal Backend Evolution Overview
70 pages
Designing Data-Intensive Apps Cheat Sheet
PDF
No ratings yet
Designing Data-Intensive Apps Cheat Sheet
10 pages
Big Data Model Paper 1
PDF
No ratings yet
Big Data Model Paper 1
28 pages
Data Distribution Models Explained
PDF
No ratings yet
Data Distribution Models Explained
40 pages