Changeset View
Changeset View
Standalone View
Standalone View
src/leveldb/README.md
Show All 10 Lines | # Features | ||||
* The basic operations are `Put(key,value)`, `Get(key)`, `Delete(key)`. | * The basic operations are `Put(key,value)`, `Get(key)`, `Delete(key)`. | ||||
* Multiple changes can be made in one atomic batch. | * Multiple changes can be made in one atomic batch. | ||||
* Users can create a transient snapshot to get a consistent view of data. | * Users can create a transient snapshot to get a consistent view of data. | ||||
* Forward and backward iteration is supported over the data. | * Forward and backward iteration is supported over the data. | ||||
* Data is automatically compressed using the [Snappy compression library](http://google.github.io/snappy/). | * Data is automatically compressed using the [Snappy compression library](http://google.github.io/snappy/). | ||||
* External activity (file system operations etc.) is relayed through a virtual interface so users can customize the operating system interactions. | * External activity (file system operations etc.) is relayed through a virtual interface so users can customize the operating system interactions. | ||||
# Documentation | # Documentation | ||||
[LevelDB library documentation](https://rawgit.com/google/leveldb/master/doc/index.html) is online and bundled with the source code. | [LevelDB library documentation](https://github.com/google/leveldb/blob/master/doc/index.md) is online and bundled with the source code. | ||||
# Limitations | # Limitations | ||||
* This is not a SQL database. It does not have a relational data model, it does not support SQL queries, and it has no support for indexes. | * This is not a SQL database. It does not have a relational data model, it does not support SQL queries, and it has no support for indexes. | ||||
* Only a single process (possibly multi-threaded) can access a particular database at a time. | * Only a single process (possibly multi-threaded) can access a particular database at a time. | ||||
* There is no client-server support builtin to the library. An application that needs such support will have to wrap their own server around the library. | * There is no client-server support builtin to the library. An application that needs such support will have to wrap their own server around the library. | ||||
# Contributing to the leveldb Project | # Contributing to the leveldb Project | ||||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | |||||
Note that the database created by the benchmark is quite small. | Note that the database created by the benchmark is quite small. | ||||
Therefore the report characterizes the performance of leveldb when the | Therefore the report characterizes the performance of leveldb when the | ||||
working set fits in memory. The cost of reading a piece of data that | working set fits in memory. The cost of reading a piece of data that | ||||
is not present in the operating system buffer cache will be dominated | is not present in the operating system buffer cache will be dominated | ||||
by the one or two disk seeks needed to fetch the data from disk. | by the one or two disk seeks needed to fetch the data from disk. | ||||
Write performance will be mostly unaffected by whether or not the | Write performance will be mostly unaffected by whether or not the | ||||
working set fits in memory. | working set fits in memory. | ||||
readrandom : 16.677 micros/op; (approximately 60,000 reads per second) | readrandom : 16.677 micros/op; (approximately 60,000 reads per second) | ||||
readseq : 0.476 micros/op; 232.3 MB/s | readseq : 0.476 micros/op; 232.3 MB/s | ||||
readreverse : 0.724 micros/op; 152.9 MB/s | readreverse : 0.724 micros/op; 152.9 MB/s | ||||
LevelDB compacts its underlying storage data in the background to | LevelDB compacts its underlying storage data in the background to | ||||
improve read performance. The results listed above were done | improve read performance. The results listed above were done | ||||
immediately after a lot of random writes. The results after | immediately after a lot of random writes. The results after | ||||
compactions (which are usually triggered automatically) are better. | compactions (which are usually triggered automatically) are better. | ||||
readrandom : 11.602 micros/op; (approximately 85,000 reads per second) | readrandom : 11.602 micros/op; (approximately 85,000 reads per second) | ||||
readseq : 0.423 micros/op; 261.8 MB/s | readseq : 0.423 micros/op; 261.8 MB/s | ||||
readreverse : 0.663 micros/op; 166.9 MB/s | readreverse : 0.663 micros/op; 166.9 MB/s | ||||
Some of the high cost of reads comes from repeated decompression of blocks | Some of the high cost of reads comes from repeated decompression of blocks | ||||
read from disk. If we supply enough cache to the leveldb so it can hold the | read from disk. If we supply enough cache to the leveldb so it can hold the | ||||
uncompressed blocks in memory, the read performance improves again: | uncompressed blocks in memory, the read performance improves again: | ||||
readrandom : 9.775 micros/op; (approximately 100,000 reads per second before compaction) | readrandom : 9.775 micros/op; (approximately 100,000 reads per second before compaction) | ||||
readrandom : 5.215 micros/op; (approximately 190,000 reads per second after compaction) | readrandom : 5.215 micros/op; (approximately 190,000 reads per second after compaction) | ||||
## Repository contents | ## Repository contents | ||||
See doc/index.html for more explanation. See doc/impl.html for a brief overview of the implementation. | See [doc/index.md](doc/index.md) for more explanation. See | ||||
[doc/impl.md](doc/impl.md) for a brief overview of the implementation. | |||||
The public interface is in include/*.h. Callers should not include or | The public interface is in include/*.h. Callers should not include or | ||||
rely on the details of any other header files in this package. Those | rely on the details of any other header files in this package. Those | ||||
internal APIs may be changed without warning. | internal APIs may be changed without warning. | ||||
Guide to header files: | Guide to header files: | ||||
* **include/db.h**: Main interface to the DB: Start here | * **include/db.h**: Main interface to the DB: Start here | ||||
* **include/options.h**: Control over the behavior of an entire database, | * **include/options.h**: Control over the behavior of an entire database, | ||||
and also control over the behavior of individual reads and writes. | and also control over the behavior of individual reads and writes. | ||||
* **include/comparator.h**: Abstraction for user-specified comparison function. | * **include/comparator.h**: Abstraction for user-specified comparison function. | ||||
If you want just bytewise comparison of keys, you can use the default | If you want just bytewise comparison of keys, you can use the default | ||||
comparator, but clients can write their own comparator implementations if they | comparator, but clients can write their own comparator implementations if they | ||||
want custom ordering (e.g. to handle different character encodings, etc.) | want custom ordering (e.g. to handle different character encodings, etc.) | ||||
* **include/iterator.h**: Interface for iterating over data. You can get | * **include/iterator.h**: Interface for iterating over data. You can get | ||||
an iterator from a DB object. | an iterator from a DB object. | ||||
* **include/write_batch.h**: Interface for atomically applying multiple | * **include/write_batch.h**: Interface for atomically applying multiple | ||||
updates to a database. | updates to a database. | ||||
* **include/slice.h**: A simple module for maintaining a pointer and a | * **include/slice.h**: A simple module for maintaining a pointer and a | ||||
length into some other byte array. | length into some other byte array. | ||||
* **include/status.h**: Status is returned from many of the public interfaces | * **include/status.h**: Status is returned from many of the public interfaces | ||||
and is used to report success and various kinds of errors. | and is used to report success and various kinds of errors. | ||||
* **include/env.h**: | * **include/env.h**: | ||||
Abstraction of the OS environment. A posix implementation of this interface is | Abstraction of the OS environment. A posix implementation of this interface is | ||||
in util/env_posix.cc | in util/env_posix.cc | ||||
* **include/table.h, include/table_builder.h**: Lower-level modules that most | * **include/table.h, include/table_builder.h**: Lower-level modules that most | ||||
clients probably won't use directly | clients probably won't use directly |