Skip to content

Instantly share code, notes, and snippets.

@hyc
Created February 6, 2015 01:21
Show Gist options
  • Select an option

  • Save hyc/9810a14488c71e58038c to your computer and use it in GitHub Desktop.

Select an option

Save hyc/9810a14488c71e58038c to your computer and use it in GitHub Desktop.
LMDB integer key vs string key
violino:/home/software/leveldb> ./db_bench_mdb --intkey=1
LMDB: version LMDB 0.9.14: (September 20, 2014)
Date: Fri Feb 6 01:18:51 2015
CPU: 4 * Intel(R) Core(TM)2 Extreme CPU Q9300 @ 2.53GHz
CPUCache: 6144 KB
Keys: 4 bytes each
Values: 100 bytes each (50 bytes after compression)
Entries: 1000000
RawSize: 99.2 MB (estimated)
FileSize: 51.5 MB (estimated)
------------------------------------------------
fillrandsync : 13.479 micros/op 74189 ops/sec; 7.6 MB/s (1000 ops)
212 /tmp/leveldbtest-1000/dbbench_mdb-1
125872 /tmp/leveldbtest-1000/dbbench_mdb-6
126084 /tmp/leveldbtest-1000
fillrandom : 3.538 micros/op 282608 ops/sec; 29.1 MB/s
109120 /tmp/leveldbtest-1000/dbbench_mdb-2
109120 /tmp/leveldbtest-1000
fillrandbatch : 3.153 micros/op 317182 ops/sec; 32.7 MB/s
118268 /tmp/leveldbtest-1000/dbbench_mdb-3
118268 /tmp/leveldbtest-1000
fillseqsync : 15.789 micros/op 63335 ops/sec; 6.5 MB/s (1000 ops)
164 /tmp/leveldbtest-1000/dbbench_mdb-4
164 /tmp/leveldbtest-1000
fillseq : 1.643 micros/op 608484 ops/sec; 62.7 MB/s
118224 /tmp/leveldbtest-1000/dbbench_mdb-5
118224 /tmp/leveldbtest-1000
fillseqbatch : 0.242 micros/op 4135341 ops/sec; 425.9 MB/s
118224 /tmp/leveldbtest-1000/dbbench_mdb-6
118224 /tmp/leveldbtest-1000
overwrite : 4.044 micros/op 247295 ops/sec; 25.5 MB/s
118224 /tmp/leveldbtest-1000/dbbench_mdb-6
118224 /tmp/leveldbtest-1000
readrandom : 0.297 micros/op 3365473 ops/sec; (31 of 1000000 found)
readseq : 0.051 micros/op 19434457 ops/sec; 2001.7 MB/s
readreverse : 0.044 micros/op 22579479 ops/sec; 2325.6 MB/s
LMDB: version LMDB 0.9.14: (September 20, 2014)
Date: Fri Feb 6 01:18:27 2015
CPU: 4 * Intel(R) Core(TM)2 Extreme CPU Q9300 @ 2.53GHz
CPUCache: 6144 KB
Keys: 16 bytes each
Values: 100 bytes each (50 bytes after compression)
Entries: 1000000
RawSize: 110.6 MB (estimated)
FileSize: 62.9 MB (estimated)
------------------------------------------------
fillrandsync : 13.374 micros/op 74771 ops/sec; 8.3 MB/s (1000 ops)
224 /tmp/leveldbtest-1000/dbbench_mdb-1
224 /tmp/leveldbtest-1000
fillrandom : 4.279 micros/op 233705 ops/sec; 25.9 MB/s
116548 /tmp/leveldbtest-1000/dbbench_mdb-2
116548 /tmp/leveldbtest-1000
fillrandbatch : 4.245 micros/op 235573 ops/sec; 26.1 MB/s
126384 /tmp/leveldbtest-1000/dbbench_mdb-3
126384 /tmp/leveldbtest-1000
fillseqsync : 17.454 micros/op 57293 ops/sec; 6.3 MB/s (1000 ops)
172 /tmp/leveldbtest-1000/dbbench_mdb-4
172 /tmp/leveldbtest-1000
fillseq : 3.795 micros/op 263486 ops/sec; 29.1 MB/s
125872 /tmp/leveldbtest-1000/dbbench_mdb-5
125872 /tmp/leveldbtest-1000
fillseqbatch : 0.445 micros/op 2248924 ops/sec; 248.8 MB/s
125872 /tmp/leveldbtest-1000/dbbench_mdb-6
125872 /tmp/leveldbtest-1000
overwrite : 4.875 micros/op 205119 ops/sec; 22.7 MB/s
125872 /tmp/leveldbtest-1000/dbbench_mdb-6
125872 /tmp/leveldbtest-1000
readrandom : 1.217 micros/op 821741 ops/sec; (1000000 of 1000000 found)
readseq : 0.058 micros/op 17205485 ops/sec; 1903.4 MB/s
readreverse : 0.042 micros/op 23957834 ops/sec; 2650.4 MB/s
@leiless
Copy link
Copy Markdown

leiless commented Sep 27, 2023

Cool! It seems there is no major performance difference between the INT key and the string key (4 bytes vs. 16 bytes).

(Don't know the 2023 version of this benchmark.)

And for the INT key benchmarks, did you use INTEGER_KEY for the backing DB? Have you tried the 8-byte INT key?

http://www.lmdb.tech/bench/microbench/
http://www.lmdb.tech/bench/microbench/db_bench_mdb.cc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment