-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpart-iii.html
556 lines (241 loc) · 24 KB
/
part-iii.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
<!DOCTYPE HTML>
<html lang="" >
<head>
<meta charset="UTF-8">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>第三部分:衍生数据 · GitBook</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="description" content="">
<meta name="generator" content="GitBook 3.2.3">
<link rel="stylesheet" href="gitbook/style.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-intopic-toc/style.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-search-pro/search.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-splitter/splitter.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-theme-comscore/test.css">
<meta name="HandheldFriendly" content="true"/>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
<link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
<link rel="next" href="ch10.html" />
<link rel="prev" href="ch9.html" />
</head>
<body>
<div class="book">
<div class="book-summary">
<div id="book-search-input" role="search">
<input type="text" placeholder="Type to search" />
</div>
<nav role="navigation">
<ul class="summary">
<li class="chapter " data-level="1.1" data-path="./">
<a href="./">
简介
</a>
</li>
<li class="chapter " data-level="1.2" data-path="preface.html">
<a href="preface.html">
序言
</a>
</li>
<li class="chapter " data-level="1.3" data-path="part-i.html">
<a href="part-i.html">
第一部分:数据系统的基石
</a>
<ul class="articles">
<li class="chapter " data-level="1.3.1" data-path="ch1.html">
<a href="ch1.html">
第一章:可靠性、可伸缩性、可维护性
</a>
</li>
<li class="chapter " data-level="1.3.2" data-path="ch2.html">
<a href="ch2.html">
第二章:数据模型与查询语言
</a>
</li>
<li class="chapter " data-level="1.3.3" data-path="ch3.html">
<a href="ch3.html">
第三章:存储与检索
</a>
</li>
<li class="chapter " data-level="1.3.4" data-path="ch4.html">
<a href="ch4.html">
第四章:编码与演化
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.4" data-path="part-ii.html">
<a href="part-ii.html">
第二部分:分布式数据
</a>
<ul class="articles">
<li class="chapter " data-level="1.4.1" data-path="ch5.html">
<a href="ch5.html">
第五章:复制
</a>
</li>
<li class="chapter " data-level="1.4.2" data-path="ch6.html">
<a href="ch6.html">
第六章:分区
</a>
</li>
<li class="chapter " data-level="1.4.3" data-path="ch7.html">
<a href="ch7.html">
第七章:事务
</a>
</li>
<li class="chapter " data-level="1.4.4" data-path="ch8.html">
<a href="ch8.html">
第八章:分布式系统的麻烦
</a>
</li>
<li class="chapter " data-level="1.4.5" data-path="ch9.html">
<a href="ch9.html">
第九章:一致性与共识
</a>
</li>
</ul>
</li>
<li class="chapter active" data-level="1.5" data-path="part-iii.html">
<a href="part-iii.html">
第三部分:衍生数据
</a>
<ul class="articles">
<li class="chapter " data-level="1.5.1" data-path="ch10.html">
<a href="ch10.html">
第十章:批处理
</a>
</li>
<li class="chapter " data-level="1.5.2" data-path="ch11.html">
<a href="ch11.html">
第十一章:流处理
</a>
</li>
<li class="chapter " data-level="1.5.3" data-path="ch12.html">
<a href="ch12.html">
第十二章:数据系统的未来
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.6" data-path="glossary.html">
<a href="glossary.html">
术语表
</a>
</li>
<li class="chapter " data-level="1.7" data-path="colophon.html">
<a href="colophon.html">
后记
</a>
</li>
<li class="divider"></li>
<li>
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
Published with GitBook
</a>
</li>
</ul>
</nav>
</div>
<div class="book-body">
<div class="body-inner">
<div class="book-header" role="navigation">
<!-- Title -->
<h1>
<i class="fa fa-circle-o-notch fa-spin"></i>
<a href="." >第三部分:衍生数据</a>
</h1>
</div>
<div class="page-wrapper" tabindex="-1" role="main">
<div class="page-inner">
<div id="book-search-results">
<div class="search-noresults">
<section class="normal markdown-section">
<h1 id="第三部分:衍生数据">第三部分:衍生数据</h1>
<p>在本书的<a href="part-i.html">第一部分</a>和<a href="part-ii.html">第二部分</a>中,我们自底向上地把所有关于分布式数据库的主要考量都过了一遍。从数据在磁盘上的布局,一直到出现故障时分布式系统一致性的局限。但所有的讨论都假定了应用中只用了一种数据库。</p>
<p>现实世界中的数据系统往往更为复杂。大型应用程序经常需要以多种方式访问和处理数据,没有一个数据库可以同时满足所有这些不同的需求。因此应用程序通常组合使用多种组件:数据存储,索引,缓存,分析系统,等等,并实现在这些组件中移动数据的机制。</p>
<p>本书的最后一部分,会研究将多个不同数据系统(可能有着不同数据模型,并针对不同的访问模式进行优化)集成为一个协调一致的应用架构时,会遇到的问题。软件供应商经常会忽略这一方面的生态建设,并声称他们的产品能够满足你的所有需求。在现实世界中,集成不同的系统是实际应用中最重要的事情之一。</p>
<h2 id="记录和衍生数据系统">记录和衍生数据系统</h2>
<p>从高层次上看,存储和处理数据的系统可以分为两大类:</p>
<h4 id="记录系统(system-of-record)">记录系统(System of record)</h4>
<p><strong>记录系统</strong>,也被称为<strong>真相源(source of truth)</strong>,持有数据的权威版本。当新的数据进入时(例如,用户输入)首先会记录在这里。每个事实正正好好表示一次(表示通常是<strong>标准化的(normalized)</strong>)。如果其他系统和<strong>记录系统</strong>之间存在任何差异,那么记录系统中的值是正确的(根据定义)。</p>
<h4 id="衍生数据系统(derived-data-systems)">衍生数据系统(Derived data systems)</h4>
<p><strong>衍生系统</strong>中的数据,通常是另一个系统中的现有数据以某种方式进行转换或处理的结果。如果丢失衍生数据,可以从原始来源重新创建。典型的例子是<strong>缓存(cache)</strong>:如果数据在缓存中,就可以由缓存提供服务;如果缓存不包含所需数据,则降级由底层数据库提供。非规范化的值,索引和物化视图亦属此类。在推荐系统中,预测汇总数据通常衍生自用户日志。</p>
<p>从技术上讲,衍生数据是<strong>冗余的(redundant)</strong>,因为它重复了已有的信息。但是衍生数据对于获得良好的只读查询性能通常是至关重要的。它通常是非规范化的。可以从单个源头衍生出多个不同的数据集,使你能从不同的“视角”洞察数据。</p>
<p>并不是所有的系统都在其架构中明确区分<strong>记录系统</strong>和<strong>衍生数据系统</strong>,但是这是一种有用的区分方式,因为它明确了系统中的数据流:系统的哪一部分具有哪些输入和哪些输出,以及它们如何相互依赖。</p>
<p>大多数数据库,存储引擎和查询语言,本质上既不是记录系统也不是衍生系统。数据库只是一个工具:如何使用它取决于你自己。<strong>记录系统和衍生数据系统之间的区别不在于工具,而在于应用程序中的使用方式。</strong></p>
<p>通过梳理数据的衍生关系,可以清楚地理解一个令人困惑的系统架构。这将贯穿本书的这一部分。</p>
<h2 id="章节概述">章节概述</h2>
<p>我们将从<a href="ch10.html">第十章</a>开始,研究例如MapReduce这样 <strong>面向批处理(batch-oriented)</strong> 的数据流系统。对于建设大规模数据系统,我们将看到,它们提供了优秀的工具和思想。<a href="ch11.html">第十一章</a>将把这些思想应用到 <strong>流式数据(data streams)</strong> 中,使我们能用更低的延迟完成同样的任务。<a href="ch12.html">第十二章</a>将对本书进行总结,探讨如何使用这些工具来构建可靠,可伸缩和可维护的应用。</p>
<h2 id="索引">索引</h2>
<ol>
<li><a href="ch10.html">批处理</a></li>
<li><a href="ch11.html">流处理</a></li>
<li><a href="ch12.html">数据系统的未来</a></li>
</ol>
<hr>
<table>
<thead>
<tr>
<th>上一章</th>
<th>目录</th>
<th>下一章</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="ch9.html">第九章:一致性与共识</a></td>
<td><a href="./">设计数据密集型应用</a></td>
<td><a href="ch10.html">第十章:批处理</a></td>
</tr>
</tbody>
</table>
</section>
</div>
<div class="search-results">
<div class="has-results">
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
<ul class="search-results-list"></ul>
</div>
<div class="no-results">
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
</div>
</div>
</div>
</div>
</div>
</div>
<a href="ch9.html" class="navigation navigation-prev " aria-label="Previous page: 第九章:一致性与共识">
<i class="fa fa-angle-left"></i>
</a>
<a href="ch10.html" class="navigation navigation-next " aria-label="Next page: 第十章:批处理">
<i class="fa fa-angle-right"></i>
</a>
</div>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"第三部分:衍生数据","level":"1.5","depth":1,"next":{"title":"第十章:批处理","level":"1.5.1","depth":2,"path":"ch10.md","ref":"ch10.md","articles":[]},"previous":{"title":"第九章:一致性与共识","level":"1.4.5","depth":2,"path":"ch9.md","ref":"ch9.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["callouts@git+https://github.com/Simran-B/gitbook-plugin-callouts.git","intopic-toc","theme-comscore","-lunr","-search","search-pro","github","splitter","-sharing","mathjax-pro","livereload"],"pluginsConfig":{"callouts":{"showTypeInHeader":true},"github":{"url":"https://github.com/KnowledgeHive/ddia"},"intopic-toc":{"isCollapsed":false,"isScrollspyActive":true,"label":{"de":"导航","en":"导航","ch":"导航"},"maxDepth":6,"mode":"nested","selector":".markdown-section h1, .markdown-section h2, .markdown-section h3, .markdown-section h4, .markdown-section h5, .markdown-section h6","visible":true},"livereload":{},"splitter":{},"search-pro":{},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"theme-comscore":{},"mathjax-pro":{"forceSVG":false,"version":"2.7.7"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"part-iii.md","mtime":"2020-12-01T02:42:40.000Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-12-21T05:58:49.715Z"},"basePath":".","book":{"language":""}});
});
</script>
</div>
<script src="gitbook/gitbook.js"></script>
<script src="gitbook/theme.js"></script>
<script src="gitbook/gitbook-plugin-intopic-toc/anchor.min.js"></script>
<script src="gitbook/gitbook-plugin-intopic-toc/gumshoe.polyfills.min.js"></script>
<script src="gitbook/gitbook-plugin-intopic-toc/plugin.js"></script>
<script src="gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
<script src="gitbook/gitbook-plugin-search-pro/search.js"></script>
<script src="gitbook/gitbook-plugin-github/plugin.js"></script>
<script src="gitbook/gitbook-plugin-splitter/splitter.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script src="gitbook/gitbook-plugin-mathjax-pro/plugin.js"></script>
<script src="gitbook/gitbook-plugin-livereload/plugin.js"></script>
<script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
<script src="gitbook/gitbook-plugin-theme-comscore/test.js"></script>
</body>
</html>