Skip to content

Commit d7cceeb

Browse files
committed
doc: document TableConfig
1 parent c61b92b commit d7cceeb

File tree

3 files changed

+27
-23
lines changed

3 files changed

+27
-23
lines changed

README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ constants:
119119
- The variable *b* usually refers to the size of a batch of
120120
inputs/outputs. Its precise meaning is explained for each occurrence.
121121

122-
- The constant *B* refers to the size of the write buffer, which is a
123-
configuration parameter.
122+
- The constant *B* refers to the size of the write buffer, which is
123+
determined by the `TableConfig` parameter `confWriteBufferAlloc`.
124124

125-
- The constant *T* refers to the size ratio of the table, which is a
126-
configuration parameter.
125+
- The constant *T* refers to the size ratio of the table, which is
126+
determined by the `TableConfig` parameter `confSizeRatio`.
127127

128128
- The constant *P* refers to the the average number of key–value pairs
129129
that fit in a page of memory.
@@ -133,7 +133,8 @@ constants:
133133
The following table summarises the cost of the operations on LSM-trees
134134
measured in the number of disk I/O operations. If the cost depends on
135135
the merge policy, the table contains one entry for each merge policy.
136-
Otherwise, the merge policy is listed as N/A.
136+
Otherwise, the merge policy is listed as N/A. The merge policy is
137+
determined by the `TableConfig` parameter `confMergePolicy`.
137138

138139
<table>
139140
<thead>
@@ -266,9 +267,9 @@ The worst-case in-memory size of an LSM-tree is *O*(*n*).
266267
- The worst-case in-memory size of the write buffer is *O*(*B*).
267268

268269
The maximum size of the write buffer on the write buffer allocation
269-
strategy, which is determined by the `confWriteBufferAlloc` field of
270-
`TableConfig`. Regardless of write buffer allocation strategy, the
271-
size of the write buffer may never exceed 4GiB.
270+
strategy, which is determined by the `TableConfig` parameter
271+
`confWriteBufferAlloc`. Regardless of write buffer allocation
272+
strategy, the size of the write buffer may never exceed 4GiB.
272273

273274
`AllocNumEntries maxEntries`
274275
The maximum size of the write buffer is the maximum number of entries
@@ -279,8 +280,8 @@ The worst-case in-memory size of an LSM-tree is *O*(*n*).
279280
The total in-memory size of all Bloom filters is the number of bits
280281
per physical entry multiplied by the number of physical entries. The
281282
required number of bits per physical entry is determined by the Bloom
282-
filter allocation strategy, which is determined by the
283-
`confBloomFilterAlloc` field of `TableConfig`.
283+
filter allocation strategy, which is determined by the `TableConfig`
284+
parameter `confBloomFilterAlloc`.
284285

285286
`AllocFixed bitsPerPhysicalEntry`
286287
The number of bits per physical entry is specified as
@@ -304,9 +305,9 @@ The worst-case in-memory size of an LSM-tree is *O*(*n*).
304305
- The worst-case in-memory size of the indexes is *O*(*n*).
305306

306307
The total in-memory size of all indexes depends on the index type,
307-
which is determined by the `confFencePointerIndex` field of
308-
`TableConfig`. The in-memory size of the various indexes is described
309-
in reference to the size of the database in [*memory
308+
which is determined by the `TableConfig` parameter
309+
`confFencePointerIndex`. The in-memory size of the various indexes is
310+
described in reference to the size of the database in [*memory
310311
pages*](https://en.wikipedia.org/wiki/Page_%28computer_memory%29 "https://en.wikipedia.org/wiki/Page_%28computer_memory%29").
311312

312313
`OrdinaryIndex`

lsm-tree.cabal

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ description:
7171
* The variable \(s\) refers to the number of snapshots in the session.
7272
* The variable \(b\) usually refers to the size of a batch of inputs\/outputs.
7373
Its precise meaning is explained for each occurrence.
74-
* The constant \(B\) refers to the size of the write buffer, which is a configuration parameter.
75-
* The constant \(T\) refers to the size ratio of the table, which is a configuration parameter.
74+
* The constant \(B\) refers to the size of the write buffer,
75+
which is determined by the @TableConfig@ parameter @confWriteBufferAlloc@.
76+
* The constant \(T\) refers to the size ratio of the table,
77+
which is determined by the @TableConfig@ parameter @confSizeRatio@.
7678
* The constant \(P\) refers to the the average number of key–value pairs that fit in a page of memory.
7779

7880
=== Disk I\/O cost of operations #performance_time#
@@ -81,6 +83,7 @@ description:
8183
measured in the number of disk I\/O operations.
8284
If the cost depends on the merge policy, the table contains one entry for each merge policy.
8385
Otherwise, the merge policy is listed as N\/A.
86+
The merge policy is determined by the @TableConfig@ parameter @confMergePolicy@.
8487

8588
+----------+------------------------+----------------------------+------------------------------------------------+
8689
| Resource | Operation | Merge policy | Cost in disk I\/O operations |
@@ -131,7 +134,8 @@ description:
131134

132135
* The worst-case in-memory size of the write buffer is \(O(B)\).
133136

134-
The maximum size of the write buffer on the write buffer allocation strategy, which is determined by the @confWriteBufferAlloc@ field of @TableConfig@.
137+
The maximum size of the write buffer on the write buffer allocation strategy,
138+
which is determined by the @TableConfig@ parameter @confWriteBufferAlloc@.
135139
Regardless of write buffer allocation strategy, the size of the write buffer may never exceed 4GiB.
136140

137141
[@AllocNumEntries maxEntries@]:
@@ -140,7 +144,8 @@ description:
140144
* The worst-case in-memory size of the Bloom filters is \(O(n)\).
141145

142146
The total in-memory size of all Bloom filters is the number of bits per physical entry multiplied by the number of physical entries.
143-
The required number of bits per physical entry is determined by the Bloom filter allocation strategy, which is determined by the @confBloomFilterAlloc@ field of @TableConfig@.
147+
The required number of bits per physical entry is determined by the Bloom filter allocation strategy,
148+
which is determined by the @TableConfig@ parameter @confBloomFilterAlloc@.
144149

145150
[@AllocFixed bitsPerPhysicalEntry@]:
146151
The number of bits per physical entry is specified as @bitsPerPhysicalEntry@.
@@ -165,7 +170,8 @@ description:
165170

166171
* The worst-case in-memory size of the indexes is \(O(n)\).
167172

168-
The total in-memory size of all indexes depends on the index type, which is determined by the @confFencePointerIndex@ field of @TableConfig@.
173+
The total in-memory size of all indexes depends on the index type,
174+
which is determined by the @TableConfig@ parameter @confFencePointerIndex@.
169175
The in-memory size of the various indexes is described in reference to the size of the database in [/memory pages/](https://en.wikipedia.org/wiki/Page_%28computer_memory%29).
170176

171177
[@OrdinaryIndex@]:

src/Database/LSMTree/Internal/Config.hs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ A collection of configuration parameters for tables, which can be used to tune t
5454
5555
Each parameter is associated with its own type.
5656
Detailed discussion of the use of each parameter can be found in the documentation for its associated type.
57-
These discussions may require some understanding of the internals of the LSM-tree.
57+
For an overview, see the [Performance](../#performance) section in the package description.
5858
59-
The 'defaultTableConfig' defines resonable defaults for all parameters.
59+
The 'defaultTableConfig' defines reasonable defaults for all parameters.
6060
-}
6161
data TableConfig = TableConfig {
6262
-- | The merge policy determines how the table manages its data,
@@ -68,14 +68,11 @@ data TableConfig = TableConfig {
6868
-- | The write buffer allocation strategy determines the maximum size of the in-memory write buffer,
6969
-- and is the parameter \(B\) in the disk I\/O cost of operations.
7070
-- Irrespective of this parameter, the write buffer size cannot exceed 4GiB.
71-
-- See [In-memory size of tables](../#performance_size).
7271
, confWriteBufferAlloc :: !WriteBufferAlloc
7372
-- | The Bloom filter allocation strategy determines the number of bits per physical entry allocated for the Bloom filters.
74-
-- See [In-memory size of tables](../#performance_size).
7573
, confBloomFilterAlloc :: !BloomFilterAlloc
7674
-- | The fence pointer index type determines the type of indexes,
7775
-- which affects the in-memory size of the table and may constrain the table keys.
78-
-- See [In-memory size of tables](../#performance_size).
7976
, confFencePointerIndex :: !FencePointerIndexType
8077
-- | The disk cache policy determines the policy for caching data from disk in memory,
8178
-- which may affect the performance of lookup operations.

0 commit comments

Comments
 (0)