Benchmark tests with another fast database managers Berkeley DB(4.7.25) and Tokyo Cabinet(1.3.12).
(OS version and machine spec for benchmarks are CentOS(2.6.18-92.1.13.el5xen) and Intel(R) Core(TM)2 Duo CPU E7200 @ 2.53GHz 4GB Memory)
Lux IO (B+-tree) | Berkeley DB (B+-tree) | Tokyo Cabinet (B+-tree) | |
---|---|---|---|
1 million records (sequential insert) (s) | 2.140 (1.048 with bulk-loading) | 2.573 | 1.472 |
1 million records (sequential select) (s) | 1.878 | 2.208 | 1.245 |
1 million records (random insert) (s) | 3.587 | 3.875 | 5.134 |
1 million records (random select) (s) | 2.424 | 2.772 | 3.051 |
50 thousands large records (sequential insert) (s) | 71.357 (non-cluster index) | 91.517 | 83.482 | 50 thousands large records (sequential select) (s) | 79.243 (non-cluster index) | over 10 minutes | 62.379 |
50 thousands large records (random insert) (s) | 77.099 (non-cluster index) | - (too slow) | 925.255 | 50 thousands large records (random select) (s) | 101.833 (non-cluster index) | - (too slow) | 591.589 |
Lux IO is very fast in both sequential and random access and also can hold large data efficiently like no other.
It gives super good performance for large expanding data as a value. (it's not in the list.)
All the tests for Berkeley DB and Tokyo Cabinet are appropriate tuned to get maximum performance under the same condition as Lux IO as far as I could.
$ ./configure $ make # nothing to compile for now. $ sudo make install # copy header files to the specified directory
sequential insert on 1 million records
#include <luxio/btree.h> #include <iostream> #define NUM_RECORDS 1000000 int main(void) { Lux::IO::Btree *bt = new Lux::IO::Btree(Lux::IO::CLUSTER); bt->open("test", Lux::IO::DB_CREAT); char str[9]; for (int i = 0; i < NUM_RECORDS; ++i) { sprintf(str, "%08d", i); Lux::IO::data_t key = {str, strlen(str)}; Lux::IO::data_t val = {&i, sizeof(int)}; bt->put(&key, &val); // insert operation } bt->close(); delete bt; return 0; }
sequential select on 1 million records
#include <luxio/btree.h> #include <iostream> #define NUM_RECORDS 1000000 int main(void) { Lux::IO::Btree *bt = new Lux::IO::Btree(Lux::IO::CLUSTER); bt->open("test", Lux::IO::DB_RDONLY); char str[9]; for (int i = 0; i < NUM_RECORDS; ++i) { sprintf(str, "%08d", i); Lux::IO::data_t key = {str, strlen(str)}; Lux::IO::data_t *val = bt->get(&key); // select operation // do something with the val // *(int *) val->data bt->clean_data(val); } bt->close(); delete bt; return 0; }
compile and excute
$ g++ put_test.cpp -o put_test -O2 -L/usr/local/lib -lluxio -lpthread -I/usr/local/include $ g++ get_test.cpp -o get_test -O2 -L/usr/local/lib -lluxio -lpthread -I/usr/local/include $ ./put_test $ ./get_testYou can see these examples in example directory.