-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
470 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,42 @@ | ||
# KVIndex | ||
A simple B+Tree based clustered Index implementation for Key-Value storage. | ||
|
||
[](https://opensource.org/licenses/mit-license.php) | ||
|
||
A simple hash index implementation for random-read-only key-value storage. | ||
|
||
## Usage | ||
|
||
1. Call `KVIndex.initialize(filename)` to create index and initialize. | ||
2. Concurrently call `KVIndex.get()` to query. | ||
|
||
## Benchmark | ||
|
||
Platform: 2.4GHz 2-core CPU, 16 GB RAM, 512 GB APPLE SSD | ||
|
||
 | ||
|
||
The benchmark shows that the number of `N` has little effect on query performance. However, due to the bottleneck of disk I/O, multithreading can hardly increase query performance. | ||
|
||
|
||
## Implementation | ||
|
||
The project implements a hash index for query-only key-value storage. | ||
|
||
All indexes are stored in the disk. There are totally (by default) 512 index files. | ||
|
||
An index file consists of several slots, each slot is (by default) 13 bytes, containing key_size, address, value_size, and next_slot_id. Collisions are handled with linked lists, where next_slot_id is used. | ||
|
||
A query first calculates the hashcode of the key. Secondly, the address of the corresponding record is retrieved from the index file. At last, read the value from the data file and return it. The second and third steps may repeat some times if there are hash collisions. The amortized number of disk accesses is 2. | ||
|
||
## Future work | ||
|
||
There are a few major factors that can be optimized to improve performance. | ||
|
||
1. [ ] better hash function | ||
2. [ ] memory buffer | ||
3. [ ] parallel initialization | ||
4. [ ] I/O optimization | ||
|
||
## Contact | ||
|
||
Please e-mail me to [email protected] for any suggestions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.