没有合适的资源?快使用搜索试试~ 我知道了~
首页A collection of System Design Interview Questions
A collection of System Design Interview Questions

A collection of System Design Interview Questions.
资源详情
资源评论
资源推荐


AcollectionofSystemDesignInterview
Questions
AntonioGulli
Copyright©2016AntonioGulliAllrightsreserved.
ISBN:1535078758
ISBN-13:978-1535078757
Systemdesignistheninthofaseriesof25Chaptersdevotedtoalgorithms,problem
solving,andC++programming.
DEDICATION
ToMimmo,myuncle.Forinspiringmypassionfortechnology
ACKNOWLEDGMENTS
ThankstoDimitrisKouzis–LoukasforhisPreciouscomments
Contents
Contents
………………………………………………………………………………………5
BasicKnowledge………………………………………………………………………….
10
1.Whataretheimportantnumberstoremember?……………………..11
Solution…………………………………………………………………………………..11
2.Whatarethefundamentalstepsforsystemdesigninterviews?…14
Solution…………………………………………………………………………………..14
3.Whataresomeprerequisitesforsysteminterviewquestions?…..17
Solution…………………………………………………………………………………..17
4.WhataretheprinciplesforWebdistributedsystemdesign?……..18
Solution…………………………………………………………………………………..18
5.Whatishorizontalandverticalscaling?…………………………………..20
Solution…………………………………………………………………………………..20
6.Whatissharding?…………………………………………………………………20
Solution…………………………………………………………………………………..20
7.Whatarethekeyrequirementswhiledesigningakey-valuestore?21
Solution…………………………………………………………………………………..21
8.Whatisconsistenthashing?…………………………………………………..21
Solution…………………………………………………………………………………..21
9.Whatarethedifferentconsistencymodels?……………………………23

Solution…………………………………………………………………………………..23
10.Whatarethedifferentmodelsofworkloaddistribution?………23
Solution…………………………………………………………………………………..23
11.WhatistheCAPTheorem?…………………………………………………24
Solution…………………………………………………………………………………..24
12.Whatis2PCandwhatisPAXOS?…………………………………………24
Solution………………………………………………………………………………….24
2PC……………………………………………………………………………………..24
PAXOS…………………………………………………………………………………25
13.Whatisvectorclock?…………………………………………………………25
Solution………………………………………………………………………………….25
14.WhatisaMerkletree?………………………………………………………26
Solution………………………………………………………………………………….26
15.DesignPatterns:Whatisapipeline?……………………………………27Solution
………………………………………………………………………………….2716.
DesignPatterns:Whatisaloadbalancer?……………………………27Solution
………………………………………………………………………………….2717.
DesignPatterns:Whatisafarmofworkers?……………………….28Solution
………………………………………………………………………………….2818.
DesignPatterns:Whatisacache?………………………………………28Solution
………………………………………………………………………………….2819.
DesignPatterns:Whatisaqueue?……………………………………..29Solution
………………………………………………………………………………….29
20.DesignPatterns:WhatisMapandReduce?Anexampleinspark30
Solution………………………………………………………………………………….30
Code……………………………………………………………………………………….
31
21.DesignPattern:WhatisaDAGScheduler?…………………………..31
Solution………………………………………………………………………………….31
22.Distributedcomputation:findthetoptenvisitedURLs…………32
Solution………………………………………………………………………………….32
23.Distributedcomputation:failure…………………………………………33
Solution………………………………………………………………………………….33
24.Distributedcomputation:generatingauniqueID…………………33
Solution…………………………………………………………………………………..33
25.Distributedcomputations:designanelevatorsystem……………34
Solution…………………………………………………………………………………..34
26.Distributedcomputation:designaratelimitingsystem…………34
Solution…………………………………………………………………………………..34
Projects………………………………………………………………………………………
3627.Project:Designaphotohostingsystem……………………………….37
Solution…………………………………………………………………………………..37
Requirements………………………………………………………………………37High
leveldesign…………………………………………………………………..37Storage
………………………………………………………………………………..38

Redundancy&Availability……………………………………………………..3928.
Project:Designadistributedcache……………………………………..40
Solution…………………………………………………………………………………..40
Requirements………………………………………………………………………40High
leveldesign…………………………………………………………………..41Coding
…………………………………………………………………………………4129.
Project:DesignaTinyURL………………………………………………….42
Solution…………………………………………………………………………………..42
Requirements………………………………………………………………………42
Estimatingthesizeoftheproblem………………………………………….42Highlevel
design…………………………………………………………………..43Coding
…………………………………………………………………………………4330.
Project:DesignaWebsearchengine…………………………………..44
Solution…………………………………………………………………………………..44
Requirements………………………………………………………………………44High
leveldesign…………………………………………………………………..45
Estimatingthesizeoftheproblem………………………………………….46Storage
……………………………………………………………………………….46
Webindex……………………………………………………………………………47
34.Project:DesignaYouTuberepository………………………………….47
Solution………………………………………………………………………………….47
Estimatingthesizeoftheproblem…………………………………………47
35.Project:DesignaFacebookstylenewsfeed…………………………48
Solution………………………………………………………………………………….48
Requirements………………………………………………………………………48
Highleveldesign…………………………………………………………………..48
PushModel………………………………………………………………………….49
PullModel……………………………………………………………………………49
Highleveldesign…………………………………………………………………..50
Estimatingthesizeoftheproblem…………………………………………50
Ranking……………………………………………………………………………….50
Scalability…………………………………………………………………………….50
36.Project:DesignaWhatsupMessagingService………………………50
Solution………………………………………………………………………………….50
Requirements………………………………………………………………………50
Highleveldesign…………………………………………………………………..50
Estimatingthesizeoftheproblem…………………………………………51
37.Project:Designanin-memorycachesimilartoMemcached51
Solution………………………………………………………………………………….51
Requirements………………………………………………………………………51
Highleveldesign…………………………………………………………………..51
Estimatingthesizeoftheproblem…………………………………………51
38.Project:DesignanAuto-completesystem……………………………51
Solution………………………………………………………………………………….51
Requirements………………………………………………………………………51
Highleveldesign…………………………………………………………………..52

Estimatingthesizeoftheproblem………………………………………….5239.Project:
DesignaRecommendationSystem………………………….53
Solution…………………………………………………………………………………..53
Requirements………………………………………………………………………53High
leveldesign…………………………………………………………………..53
Estimatingthesizeoftheproblem………………………………………….54
BasicKnowledge
1.Whataretheimportantnumberstoremember?
Solution
Inpreparationofasystemdesigninterviewitcouldbeusefultoremindsomemeasures
abouttime,storagespace,andnetworking.
TIME
Sec1Msec10^-3Usec10^-6Nsec10^-9
Data
1Kbyte10^32^10
1Mbyte10^62^20
1Gbyte10^92^302^32=4G
1Tbyte10^122*602^64=16T
1Pbyte10^152*120
Pleaserememberthatitisnotessentialtomemorizeallthecorrectvaluesforaccessinga
device(memory,storage,network)butitiscertainlyrecommendedtobeawareofthe
orderofmagnitudesinvolvedduringtheaccess.Thefollowingnumbersareanaverageof
whatyougetbyusingcommodityservers.
Memory,Network,Disk
MemoryaccessNsecRoundtripsamedatacenterUsecDiskaccessMsec
Memoryaccesstimeissignificantlyimpactedbythelevelofcacheweareconsidering.
AnL1cacheisroughlyspeaking10xfasterthanaL2cacheand100xtimesfasterthana
DIMMmemory.Again,hereweareinterestedintheorderofmagnitudesandnot
necessarilyintheactualvalues.
Memory
L1cache1nsec
L2cache10nsec
Mem100nsec
AccessingaSATAdiskcanbe10.000timesslowerthanaccessingmemory.However,
solid-statedisks(SSD)canbe10xfasterthanatraditionaldisk(thedistinctionismostlyin
termsofseektimeasbandwidthisprettymuchthesame).
Disk
Diskseek10msecRead1Mb20msecDiskSSDs0.1msecBandwidth~30M/sec
剩余33页未读,继续阅读
















安全验证
文档复制为VIP权益,开通VIP直接复制

评论1