-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdesign.php
More file actions
114 lines (102 loc) · 3.59 KB
/
design.php
File metadata and controls
114 lines (102 loc) · 3.59 KB
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
<?php require "includes/project_info.php" ?>
<?php require "../includes/header.php" ?>
<?php include "../includes/advert.php" ?>
<h1>
Design
</h1>
<p>
<strong>Krati</strong> is mainly designed for serving simple reads and writes (e.g., key-value access) from memory and providing persistency in the meanwhile.
It is intended for read-write-intensive applications with relaxed transactional semantics.
</p>
<h2>
Design Considerations:
</h2>
<ul>
<li> Simple Data Model:
<ul>
<li> Varying-length data array</li>
<li> Key-value data store</li>
</ul>
</li>
<li> Multi-Reader and Single Writer
<ul>
<li> Append-only writes</li>
<li> Concurrent reads and writes</li>
</ul>
</li>
<li> Persistency:
<ul>
<li> Write-ahead redo log</li>
<li> Periodic checkpointing</li>
<li> Writes persisted to disk in batch</li>
</ul>
</li>
<li> Performance:
<ul>
<li> Low read/write latency</li>
<li> High read/write throughput</li>
</ul>
</li>
<li> Hash-based indexing</li>
<ul>
<li> Fast equality search</li>
<li> Random reads and writes</li>
</ul>
<li> Automatic data compaction</li>
<li> Java-based:
<ul>
<li> Java Nio-enabled</li>
<li> Java GC friendly</li>
</ul>
</li>
</ul>
<h2>
Architectural Overview:
</h2>
<p>
The conceptual architecture of Krati is composed of three layers.
The top layer is the content data store service API, which includes array-like set/get methods and standard key-value store get/put/delete methods.
The bottom layer provides Java NIO-based persistency to back up data segments, indexes, and meta data via disk files.
</p>
<p>
The layer in the middle manages data segments, data indexes, and write-ahead redo logic.
Segment Manager is responsible for segment creation, recycle and compaction.
Index Manager uses hash functions to map keys to memory-resident array indexes.
It does automatic batch-based flushing to sync data, indexes, and meta data to disk files.
Data Handler allows customization of data to put into segments.
</p>
<p>
Krati segments can be thought of pure data blocks backed by files on disk. Every segment contains a number of data elements.
The index manager provides logic for retrieving indexes to data elements in a segment.
Krati always keeps indexes in memory for better performance.
</p.
<p>
Krati supports three types of segments:
<ul>
<li><b>MemorySegement</b>:
Memory resident and designed for extremely fast reads and writes.
It works for small data sets that fit into memory.
</li>
<li><b>MappedSegement</b>:
I/O page cache resident via Java/NIO mmap and designed for relatively fast reads and writes.
It works for relatively large data sets that do not fit into memory.
</li>
<li><b>ChannelSegement</b>:
I/O page cache resident and designed for relatively slow reads and writes.
It works for very large data sets that cannot fit into memory.
</li>
</ul>
</p>
<p align="center">
<img src="images/krati_architecture.jpg" />
</p>
<p>
The following diagram shows the internal implementation of the Krati main class SimpleDataArray.
Multiple readers can issue concurrent reads via DataArray get methods.
There is one and only one writer, which does append-only writes to data segments via DataArray set methods.
The writer periodically starts a compactor to perform segment compaction and reclaim wasted data space.
</p>
<p align="center">
<img src="images/krati_internal_architecture.jpg" />
</p>
<?php require "../includes/footer.php" ?>