Sequential writes leveldb versus system_x

OK, calling it a benchmark is a bit of an overstatement. It's taking two different database libraries for a quick spin, and seeing how fast they can write a bunch of integers to disk. A second benchmark checks how fast we can read them.

In this mini-test, I'm running leveldb against a new embedded database library, let's call it system_x. The purpose is really just so that I can remember some rough numbers regarding these useful database libraries.

I used the time command to gather results, which shows real, user and sys time spent.

Take with a grain of salt: It's seems that system_x (w. index) can perform random point reads 3.75 times faster than leveldb, but spends 4 times longer writing the data (sequentially).

Result

Here I present the timings data I measured for writes and reads. Something that I would like to measure, but did not do, is how long it takes to scan all the data. Both database libraries support iterating over all the records.

1 million sequential writes

Writing 1 million key-value pairs (two integers as strings) sequentially.

leveldb (indexed):

real	0m8.329s
user	0m8.264s
sys	0m0.223s

system_x (not indexed):

real	0m3.456s
user	0m2.920s
sys	0m0.105s

system_x (indexed):

real	0m34.464s
user	0m33.766s
sys	0m0.156s

10K single reads

Reading every 100th key-value pair written during sequential write phase (above).

leveldb (indexed)

real	0m0.929s
user	0m0.267s
sys	0m0.043s

system_x (not indexed)

real	0m15.410s
user	0m15.262s
sys	0m0.078s

system_x (indexed)

real	0m0.099s
user	0m0.074s
sys	0m0.023s

Conclusion

  • system_x w/o index: Faster sequential write, paid for by slower random reads (not surprising)
  • system_x w. index: Faster random reads, paid for by slower sequential writes (perhaps the real take-away).

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.