LevelDB is a library that implements a fast persistent key-value store.
Features
Keys and values are arbitrary byte arrays.
Data is stored sorted by key.
Callers can provide a custom comparison function to override the sort order.
The basic operations are Put(key,value), Get(key), Delete(key).
Multiple changes can be made in one atomic batch.
Users can create a transient snapshot to get a consistent view of data.
Forward and backward iteration is supported over the data.
Data is automatically compressed using the Snappy compression library.
External activity (file system operations etc.) is relayed through a virtual interface so users can customize the operating system interactions.
Detailed documentation about how to use the library is included with the source code.
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.
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.
Performance
Here is a performance report (with explanations) from the run of the included db_bench program. The results are somewhat noisy, but should be enough to get a ballpark performance estimate.
Setup
We use a database with a million entries. Each entry has a 16 byte key, and a 100 byte value. Values used by the benchmark compress to about half their original size.
LevelDB: version 1.1
Date: Sun May 1 12:11:26 2011
CPU: 4 x Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz
CPUCache: 4096 KB
Keys: 16 bytes each
Values: 100 bytes each (50 bytes after compression)
Entries: 1000000
Raw Size: 110.6 MB (estimated)
File Size: 62.9 MB (estimated)
Write performance
The "fill" benchmarks create a brand new database, in either sequential, or random order. The "fillsync" benchmark flushes data from the operating system to the disk after every operation; the other write operations leave the data sitting in the operating system buffer cache for a while. The "overwrite" benchmark does random writes that update existing keys in the database.
fillseq : 1.765 micros/op; 62.7 MB/s
fillsync : 268.409 micros/op; 0.4 MB/s (10000 ops)
fillrandom : 2.460 micros/op; 45.0 MB/s
overwrite : 2.380 micros/op; 46.5 MB/s
Each "op" above corresponds to a write of a single key/value pair. I.e., a random write benchmark goes at approximately 400,000 writes per second.
Each "fillsync" operation costs much less (0.3 millisecond) than a disk seek (typically 10 milliseconds). We suspect that this is because the hard disk itself is buffering the update in its memory and responding before the data has been written to the platter. This may or may not be safe based on whether or not the hard disk has enough power to save its memory in the event of a power failure.
Read performance
We list the performance of reading sequentially in both the forward and reverse direction, and also the performance of a random lookup. Note that the database created by the benchmark is quite small. Therefore the report characterizes the performance of leveldb when the 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 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 working set fits in memory.
readrandom : 16.677 micros/op; (approximately 60,000 reads per second)
readseq : 0.476 micros/op; 232.3 MB/s
readreverse : 0.724 micros/op; 152.9 MB/s
LevelDB compacts its underlying storage data in the background to improve read performance. The results listed above were done immediately after a lot of random writes. The results after compactions (which are usually triggered automatically) are better.
readrandom : 11.602 micros/op; (approximately 85,000 reads per second)
readseq : 0.423 micros/op; 261.8 MB/s
readreverse : 0.663 micros/op; 166.9 MB/s
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 uncompressed blocks in memory, the read performance improves again:
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)
分享到:
相关推荐
LevelDB是一种以写入性能见长的存储引擎,它采用了典型的LSM树(Log Structured-Merge Tree)的数据结构来实现,这是为了优化写入性能而特别设计的数据结构。LSM树放弃了部分读取性能来换取更快的写入能力,尤其适用...
在本文中,我们将深入探讨如何在Windows Presentation Foundation (WPF)环境中使用C#语言操作LevelDB数据库,并结合JSON处理技术来存储和展示数据。LevelDB是一个由Google开发的轻量级、高性能的键值对存储系统,...
【leveldb源码工程Windows版】是一个专为在Windows操作系统上编译和运行的开源键值存储系统 leveldb 的源代码包。leveldb由Google开发,它提供了一个高效的、可嵌入式的数据存储解决方案,适用于各种应用场景,如...
标题"leveldb-windows-python3.6编译版"指的是这是一个针对Windows操作系统、Python 3.6版本编译的LevelDB数据库的接口库。LevelDB是Google开发的一个轻量级、高性能的键值对存储系统,适用于嵌入式应用或作为其他...
自己编译的leveldb.so文件。 这是一个适用于arm32架构的php模块, leveldb数据库懂得都懂 下载文件中含一个压缩包(这是源码,同样含有编译样例) 一个 leveldb.so文件 这是我编译的自己用的leveldb模块,试过了...
标题中的“mnist-leveldb.7z”是一个压缩包文件,用于深度学习环境,特别是Caffe框架,其中包含了MNIST数据集的LevelDB格式版本。MNIST数据集是机器学习领域非常经典的手写数字识别数据集,常用于训练和验证图像分类...
在Windows环境下,使用Visual Studio 2013编译开源的LevelDB库并生成`leveldb.lib`静态库文件,是一项常见的任务。LevelDB是一个轻量级的键值存储库,由Google开发,用于存储小到中等大小的数据集。它的设计目标是...
《leveldb-1.18 源码及 leveldb实现解析》这份资料主要涵盖了Google开源的键值存储系统leveldb的源码分析和实现原理。leveldb作为一个高效、轻量级的数据库引擎,广泛应用于各种场景,如嵌入式系统、日志存储、缓存...
leveldb是一款高效、轻量级的键值存储库,由Google开发并开源,主要用于实现高性能的数据持久化。它的设计目标是提供一个简单且可扩展的接口,支持快速的读写操作,尤其适用于嵌入式系统和大规模分布式环境。本文将...
《LevelDB在Windows环境下使用与理解》 LevelDB是由Google开发的一个开源的、轻量级的键值存储库,主要用于嵌入式应用和系统。它提供了简单但高效的接口,适用于需要快速读写大量数据的场景。本文将深入探讨在...
leveldb是Google公司推出的高性能持久化键值存储库,它广泛应用于各种需要快速、可扩展的存储解决方案的系统中。leveldb采用了LSM树(Log-Structured Merge-Tree)模型来优化写入性能,同时在读取操作上采取了多种...
leveldb是一个由Google工程师Jeff Dean和Sanjay Ghemawat发起的开源项目,它是C++实现的,可以处理十亿级别的Key-Value型数据持久性存储。Jeff Dean和Sanjay Ghemawat是Google重量级的工程师,也是Google大规模...
LevelDB.Net.x64 是一个专为64位操作系统设计的C#封装库,它使得开发者可以方便地在.NET环境中利用Google的LevelDB键值存储系统。LevelDB是一款高效的、轻量级的开源数据库,由Google开发,主要用于本地数据持久化...
《Python3.6环境下使用LevelDB模块:leveldb.pyd》 在Python编程中,有时我们需要使用到高效的数据存储和检索系统,这时LevelDB便是一个不错的选择。LevelDB是Google开发的一个轻量级、高性能的键值对存储系统,...
《深入理解LevelDB:C++键值对存储数据库的编译与应用》 LevelDB,由Google开源的一款轻量级、高性能的键值对存储数据库,以其简洁的API、高效的数据结构和出色的性能赢得了广大开发者青睐。在Windows环境下,我们...
LevelDB是一款轻量级、高性能、单机版的键值对持久化存储库,由Google开发并开源。这个“leveldb-0.6.jar”文件是LevelDB的一个Java实现,版本为0.6,适合在Java环境中使用。它包含了数据库操作的核心类和其他必要的...
**LevelDB概述** LevelDB是由Google开发的一个轻量级、高性能、单进程的键值对存储系统,主要用于存储和检索大量的键值对数据。它基于Log-Structured Merge Tree(LSMT)的数据结构,保证了数据的一致性和持久性。...
在本文中,我们将深入探讨如何在C#的WPF(Windows Presentation Foundation)环境中利用现有类库读取LevelDB数据库,并解析存储的JSON字符串以便在界面上显示。LevelDB是由Google开发的一个轻量级、高性能的键值对...