没有合适的资源?快使用搜索试试~ 我知道了~
首页Grokking-the-System-Design-Interview.pdf
Grokking-the-System-Design-Interview.pdf
需积分: 44 293 下载量 37 浏览量
更新于2023-03-03
18
收藏 4.35MB PDF 举报
Grokking-the-System-Design-Interview.pdf
资源详情
资源推荐
![](https://csdnimg.cn/release/download_crawler_static/13837711/bg1.jpg)
1
SYSTEM DESIGN
System Design Problems ......................................................................................................................................8
System Design Interviews: A step by step guide .............................................................................................8
Step 1: Requirements clarifications ........................................................................................................8
Step 2: System interface definition .........................................................................................................9
Step 3: Back-of-the-envelope estimation ...............................................................................................9
Step 4: Defining data model ....................................................................................................................9
Step 5: High-level design ...................................................................................................................... 10
Step 6: Detailed design ......................................................................................................................... 10
Step 7: Identifying and resolving bottlenecks .................................................................................... 11
Summary ................................................................................................................................................. 11
Designing a URL Shortening service like TinyURL ......................................................................................... 12
1. Why do we need URL shortening? ................................................................................................. 12
2. Requirements and Goals of the System ........................................................................................ 12
3. Capacity Estimation and Constraints .............................................................................................. 13
4. System APIs ....................................................................................................................................... 15
5. Database Design ............................................................................................................................... 16
6. Basic System Design and Algorithm ............................................................................................... 17
a. Encoding actual URL ......................................................................................................................... 17
b. Generating keys offline ..................................................................................................................... 21
7. Data Partitioning and Replication .................................................................................................... 23
8. Cache................................................................................................................................................... 23
9. Load Balancer (LB) ............................................................................................................................ 27
10. Purging or DB cleanup .................................................................................................................... 28
11. Telemetry .......................................................................................................................................... 29
12. Security and Permissions ............................................................................................................... 29
Designing Pastebin ........................................................................................................................................ 30
1. What is Pastebin? .............................................................................................................................. 30
2. Requirements and Goals of the System ........................................................................................ 30
3. Some Design Considerations .......................................................................................................... 31
4. Capacity Estimation and Constraints .............................................................................................. 31
5. System APIs ....................................................................................................................................... 32
6. Database Design ............................................................................................................................... 33
7. High Level Design .............................................................................................................................. 34
8. Component Design ............................................................................................................................ 35
a. Application layer ................................................................................................................................. 35
b. Datastore layer ................................................................................................................................... 36
![](https://csdnimg.cn/release/download_crawler_static/13837711/bg2.jpg)
2
9. Purging or DB Cleanup ..................................................................................................................... 37
10. Data Partitioning and Replication .................................................................................................. 37
11. Cache and Load Balancer .............................................................................................................. 37
12. Security and Permissions ............................................................................................................... 37
Designing Instagram...................................................................................................................................... 38
1. What is Instagram? ............................................................................................................................ 38
2. Requirements and Goals of the System ........................................................................................ 38
3. Some Design Considerations .......................................................................................................... 39
4. Capacity Estimation and Constraints .............................................................................................. 39
5. High Level System Design ............................................................................................................... 39
6. Database Schema ............................................................................................................................. 40
7. Data Size Estimation ......................................................................................................................... 41
8. Component Design ............................................................................................................................ 42
9. Reliability and Redundancy .............................................................................................................. 43
10. Data Sharding .................................................................................................................................. 44
11. Ranking and News Feed Generation ........................................................................................... 45
12. News Feed Creation with Sharded Data ...................................................................................... 46
13. Cache and Load balancing ............................................................................................................ 47
Designing Dropbox ........................................................................................................................................ 48
1. Why Cloud Storage? ......................................................................................................................... 48
2. Requirements and Goals of the System ........................................................................................ 49
3. Some Design Considerations .......................................................................................................... 49
4. Capacity Estimation and Constraints .............................................................................................. 50
5. High Level Design .............................................................................................................................. 50
6. Component Design ............................................................................................................................ 51
a. Client .................................................................................................................................................... 51
b. Metadata Database ........................................................................................................................... 53
c. Synchronization Service.................................................................................................................... 54
d. Message Queuing Service ............................................................................................................... 55
e. Cloud/Block Storage .......................................................................................................................... 56
7. File Processing Workflow ................................................................................................................. 56
8. Data Deduplication ............................................................................................................................ 56
9. Metadata Partitioning ........................................................................................................................ 57
10. Caching ............................................................................................................................................. 58
11. Load Balancer (LB) ......................................................................................................................... 58
12. Security, Permissions and File Sharing ....................................................................................... 59
Designing Facebook Messenger.................................................................................................................... 60
![](https://csdnimg.cn/release/download_crawler_static/13837711/bg3.jpg)
3
1. What is Facebook Messenger? ....................................................................................................... 60
2. Requirements and Goals of the System ........................................................................................ 60
3. Capacity Estimation and Constraints .............................................................................................. 61
4. High Level Design .............................................................................................................................. 62
5. Detailed Component Design ............................................................................................................ 65
a. Messages Handling ........................................................................................................................... 65
b. Storing and retrieving the messages from the database ............................................................. 67
c. Managing user’s status ..................................................................................................................... 68
6. Data partitioning ................................................................................................................................. 69
7. Cache................................................................................................................................................... 70
8. Load balancing ................................................................................................................................... 70
9. Fault tolerance and Replication ....................................................................................................... 70
10. Extended Requirements ................................................................................................................. 71
a. Group chat .......................................................................................................................................... 71
b. Push notifications ............................................................................................................................... 71
Designing Twitter .......................................................................................................................................... 72
1. What is Twitter? ................................................................................................................................. 72
2. Requirements and Goals of the System ........................................................................................ 72
3. Capacity Estimation and Constraints .............................................................................................. 73
4. System APIs ....................................................................................................................................... 74
5. High Level System Design ............................................................................................................... 74
6. Database Schema ............................................................................................................................. 75
7. Data Sharding ..................................................................................................................................... 76
8. Cache................................................................................................................................................... 78
9. Timeline Generation .......................................................................................................................... 79
10. Replication and Fault Tolerance .................................................................................................... 79
11. Load Balancing ................................................................................................................................ 80
12. Monitoring ......................................................................................................................................... 80
13. Extended Requirements ................................................................................................................. 80
Designing Youtube or Netflix ........................................................................................................................ 82
1. Why Youtube? .................................................................................................................................... 82
2. Requirements and Goals of the System ........................................................................................ 82
3. Capacity Estimation and Constraints .............................................................................................. 83
4. System APIs ....................................................................................................................................... 83
5. High Level Design .............................................................................................................................. 85
6. Database Schema ............................................................................................................................. 85
7. Detailed Component Design ............................................................................................................ 86
![](https://csdnimg.cn/release/download_crawler_static/13837711/bg4.jpg)
4
8. Metadata Sharding ............................................................................................................................ 88
9. Video Deduplication ........................................................................................................................... 88
10. Load Balancing ................................................................................................................................ 89
11. Cache ................................................................................................................................................ 90
12. Content Delivery Network (CDN) .................................................................................................. 90
13. Fault Tolerance ................................................................................................................................ 91
Designing Typeahead Suggestion ................................................................................................................. 92
1. What is Typeahead Suggestion? .................................................................................................... 92
2. Requirements and Goals of the System ........................................................................................ 92
3. Basic System Design and Algorithm ............................................................................................... 92
4. Permanent Storage of the Trie ........................................................................................................ 95
5. Scale Estimation ................................................................................................................................ 96
6. Data Partition ...................................................................................................................................... 97
7. Cache................................................................................................................................................... 98
8. Replication and Load Balancer ........................................................................................................ 99
9. Fault Tolerance .................................................................................................................................. 99
10. Typeahead Client ............................................................................................................................. 99
11. Personalization ................................................................................................................................. 99
Designing an API Rate Limiter ..................................................................................................................... 100
1. What is a Rate Limiter? ................................................................................................................... 100
2. Why do we need API rate limiting? ............................................................................................... 100
3. Requirements and Goals of the System ...................................................................................... 101
4. How to do Rate Limiting?................................................................................................................ 102
5. What are different types of throttling? ........................................................................................... 102
6. What are different types of algorithms used for Rate Limiting? ................................................ 102
7. High level design for Rate Limiter ................................................................................................. 103
8. Basic System Design and Algorithm ............................................................................................. 104
9. Sliding Window algorithm ............................................................................................................... 107
10. Sliding Window with Counters ..................................................................................................... 109
11. Data Sharding and Caching ......................................................................................................... 111
12. Should we rate limit by IP or by user? ........................................................................................ 112
Designing Twitter Search ............................................................................................................................ 113
1. What is Twitter Search? .................................................................................................................. 113
2. Requirements and Goals of the System ...................................................................................... 113
3. Capacity Estimation and Constraints ............................................................................................ 113
4. System APIs ..................................................................................................................................... 114
5. High Level Design ............................................................................................................................ 114
![](https://csdnimg.cn/release/download_crawler_static/13837711/bg5.jpg)
5
6. Detailed Component Design .......................................................................................................... 115
7. Fault Tolerance ................................................................................................................................ 117
8. Cache................................................................................................................................................. 118
9. Load Balancing ................................................................................................................................. 118
10. Ranking ........................................................................................................................................... 118
Designing a Web Crawler ............................................................................................................................ 119
1. What is a Web Crawler? ................................................................................................................. 119
2. Requirements and Goals of the System ...................................................................................... 119
3. Some Design Considerations ........................................................................................................ 119
4. Capacity Estimation and Constraints ............................................................................................ 120
5. High Level design ............................................................................................................................ 121
How to crawl? ....................................................................................................................................... 121
Difficulties in implementing efficient web crawler ............................................................................ 121
6. Detailed Component Design .......................................................................................................... 122
7. Fault tolerance .................................................................................................................................. 127
8. Data Partitioning ............................................................................................................................... 127
9. Crawler Traps ................................................................................................................................... 127
Designing Facebook’s Newsfeed ................................................................................................................. 128
1. What is Facebook’s newsfeed? ..................................................................................................... 128
2. Requirements and Goals of the System ...................................................................................... 128
3. Capacity Estimation and Constraints ............................................................................................ 129
4. System APIs ..................................................................................................................................... 129
5. Database Design ............................................................................................................................. 130
6. High Level System Design ............................................................................................................. 131
7. Detailed Component Design .......................................................................................................... 132
8. Feed Ranking ................................................................................................................................... 135
9. Data Partitioning ............................................................................................................................... 136
Designing Yelp or Nearby Friends ............................................................................................................... 137
1. Why Yelp or Proximity Server? ...................................................................................................... 137
2. Requirements and Goals of the System ...................................................................................... 137
3. Scale Estimation .............................................................................................................................. 138
4. Database Schema ........................................................................................................................... 138
5. System APIs ..................................................................................................................................... 138
6. Basic System Design and Algorithm ............................................................................................. 139
a. SQL solution ..................................................................................................................................... 139
b. Grids................................................................................................................................................... 140
c. Dynamic size grids ........................................................................................................................... 142
剩余195页未读,继续阅读
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://img-home.csdnimg.cn/images/20210720083646.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://profile-avatar.csdnimg.cn/default.jpg!1)
judyintech
- 粉丝: 0
- 资源: 6
上传资源 快速赚钱
我的内容管理 收起
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![](https://csdnimg.cn/release/wenkucmsfe/public/img/voice.245cc511.png)
会员权益专享
最新资源
- 谷歌文件系统下的实用网络编码技术在分布式存储中的应用
- 跨国媒体对南亚农村社会的影响:以斯里兰卡案例的社会学分析
- RFM2g接口驱动操作手册:API与命令行指南
- 基于裸手的大数据自然人机交互关键算法研究
- ABAQUS下无人机机翼有限元分析与局部设计研究
- TCL基础教程:语法、变量与操作详解
- FPGA与数字前端面试题集锦:流程、设计与Verilog应用
- 2022全球互联网技术人才前瞻:元宇宙驱动下的创新与挑战
- 碳排放权交易实战手册(第二版):设计与实施指南
- 2022新经济新职业洞察:科技驱动下的百景变革
- 红外与可见光人脸融合识别技术探究
- NXP88W8977:2.4/5 GHz 双频 Wi-Fi4 + Bluetooth 5.2 合体芯片
- NXP88W8987:集成2.4/5GHz Wi-Fi 5与蓝牙5.2的单芯片解决方案
- TPA3116D2DADR: 单声道数字放大器驱动高达50W功率
- TPA3255-Q1:315W车载A/D类音频放大器,高保真、宽频设计
- 42V 输入 5A 降压稳压器 TPS54540B-Q1 的特点和应用
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![](https://img-home.csdnimg.cn/images/20220527035711.png)
![](https://img-home.csdnimg.cn/images/20220527035711.png)
![](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![](https://csdnimg.cn/release/wenkucmsfe/public/img/green-success.6a4acb44.png)