start doing db-scan. [t:1904]

git-svn-id: file:///svn/toku/tokudb@13646 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
Bradley C. Kuszmaul 2013-04-16 23:57:57 -04:00 committed by Yoni Fogel
parent f44010d07b
commit bb469c9203
3 changed files with 61 additions and 10 deletions

View file

@ -1,4 +1,48 @@
The db-insert program measures the insertion performance of a Tokutek Fractal Tree.
The examples includes a pair of programs that can be compiled to use either the Berkeley DB library or the Tokutek Fractal Tree index library.
The db-scan program scans all of the key value pairs of a Tokutek Fractal Tree that was built with the db-insert program.
Note: The file formats are different from TokuDB and Berkley DB. Thus
you cannot access a database created by Berkeley DB using the Tokutek
DB, or vice-versa.
db-insert is a program that inserts random key-value pairs into a database.
To build it and run it (it's been tested on Fedora 10):
$ cd db-insert
$ make (Makes the binaries)
Run the insertion workload under TokuDB:
$ ./db-insert
Run the insertion workload under BDB:
$ ./db-insert-bdb
Here is what the output looks like (this on a Thinkpad X61s laptop
running Fedora 10). BDB is a little faster for sequential insertions
(the first three columns), but much much slower for random insertions
(the next 3 coluns), so that TokuDB is faster on combined workload.
$ ./db-insert
serial and random insertions of 1048576 per batch
serial 2.609965s 401759/s random 10.983798s 95466/s cumulative 13.593869s 154272/s
serial 3.053433s 343409/s random 12.008670s 87318/s cumulative 28.656115s 146367/s
serial 5.198312s 201715/s random 15.087426s 69500/s cumulative 48.954605s 128516/s
serial 6.096396s 171999/s random 13.550688s 77382/s cumulative 68.638321s 122215/s
Shutdown 4.025110s
Total time 72.677498s for 8388608 insertions = 115422/s
$ ./db-insert-bdb
serial and random insertions of 1048576 per batch
serial 2.623888s 399627/s random 8.770850s 119552/s cumulative 11.394805s 184045/s
serial 3.081946s 340232/s random 21.046589s 49822/s cumulative 35.523434s 118071/s
serial 14.160498s 74049/s random 497.117523s 2109/s cumulative 546.804504s 11506/s
serial 1.534212s 683462/s random 1128.525146s 929/s cumulative 1676.863892s 5003/s
Shutdown 195.879242s
Total time 1872.746582s for 8388608 insertions = 4479/s
The files are smaller for TokuDB than BDB.
$ ls -lh ../bench.tokudb/
total 39M
-rwxrwxr-x 1 bradley bradley 39M 2009-07-28 15:36 bench.db
$ ls -lh ../bench.bdb/
total 322M
-rw-r--r-- 1 bradley bradley 322M 2009-07-28 16:14 bench.db
There isn't much documentation for the Tokutek Fractal Tree index library, but most of the API is like Berkeley DB's.

View file

@ -1,9 +1,9 @@
DIRSUF = db
CPPFLAGS = -I../include -DDIRSUF=$(DIRSUF)
default: db-insert db-insert-bdb
CPPFLAGS = -I../include
LDFLAGS = -L../.. -lfractaltreeindex -Wl,-rpath,../..
db-insert-bdb: db-insert.c
cc -ldb db-insert.c -o db-insert-bdb -DBDB
default: db-insert
clean:
rm -rf db-insert bench.$(DIRSUF)

View file

@ -1,9 +1,16 @@
/* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
/* Insert a bunch of stuff */
#include <inttypes.h>
// Define BDB if you want to compile this to use Berkeley DB
#ifdef BDB
#include <db.h>
#define DIRSUF bdb
#else
#include <tokudb.h>
#define DIRSUF tokudb
#endif
#include <inttypes.h>
#include <assert.h>
#include <errno.h>
#include <string.h>
@ -78,7 +85,7 @@ static void do_prelock(DB* db, DB_TXN* txn) {
#define STRINGIFY2(s) #s
#define STRINGIFY(s) STRINGIFY2(s)
const char *dbdir = "./bench." STRINGIFY(DIRSUF); /* DIRSUF is passed in as a -D argument to the compiler. */
const char *dbdir = "../bench." STRINGIFY(DIRSUF);
char *dbfilename = "bench.db";
char *dbname;
@ -98,7 +105,7 @@ static void benchmark_setup (void) {
system(unlink_cmd);
if (strcmp(dbdir, ".") != 0) {
r = toku_os_mkdir(dbdir,S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH);
r = mkdir(dbdir,S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH);
assert(r == 0);
}
}