benchmark.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>LevelDB Benchmarks</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <style>
  7. body {
  8. font-family:Helvetica,sans-serif;
  9. padding:20px;
  10. }
  11. h2 {
  12. padding-top:30px;
  13. }
  14. table.bn {
  15. width:800px;
  16. border-collapse:collapse;
  17. border:0;
  18. padding:0;
  19. }
  20. table.bnbase {
  21. width:650px;
  22. }
  23. table.bn td {
  24. padding:2px 0;
  25. }
  26. table.bn td.c1 {
  27. font-weight:bold;
  28. width:150px;
  29. }
  30. table.bn td.c1 div.e {
  31. float:right;
  32. font-weight:normal;
  33. }
  34. table.bn td.c2 {
  35. width:150px;
  36. text-align:right;
  37. padding:2px;
  38. }
  39. table.bn td.c3 {
  40. width:350px;
  41. }
  42. table.bn td.c4 {
  43. width:150px;
  44. font-size:small;
  45. padding-left:4px;
  46. }
  47. /* chart bars */
  48. div.bldb {
  49. background-color:#0255df;
  50. }
  51. div.bkct {
  52. background-color:#df5555;
  53. }
  54. div.bsql {
  55. background-color:#aadf55;
  56. }
  57. .code {
  58. font-family:monospace;
  59. font-size:large;
  60. }
  61. .todo {
  62. color: red;
  63. }
  64. </style>
  65. </head>
  66. <body>
  67. <h1>LevelDB Benchmarks</h1>
  68. <p>Google, July 2011</p>
  69. <hr>
  70. <p>In order to test LevelDB's performance, we benchmark it against other well-established database implementations. We compare LevelDB (revision 39) against <a href="http://www.sqlite.org/">SQLite3</a> (version 3.7.6.3) and <a href="http://fallabs.com/kyotocabinet/spex.html">Kyoto Cabinet's</a> (version 1.2.67) TreeDB (a B+Tree based key-value store). We would like to acknowledge Scott Hess and Mikio Hirabayashi for their suggestions and contributions to the SQLite3 and Kyoto Cabinet benchmarks, respectively.</p>
  71. <p>Benchmarks were all performed on a six-core Intel(R) Xeon(R) CPU X5650 @ 2.67GHz, with 12288 KB of total L3 cache and 12 GB of DDR3 RAM at 1333 MHz. (Note that LevelDB uses at most two CPUs since the benchmarks are single threaded: one to run the benchmark, and one for background compactions.) We ran the benchmarks on two machines (with identical processors), one with an Ext3 file system and one with an Ext4 file system. The machine with the Ext3 file system has a SATA Hitachi HDS721050CLA362 hard drive. The machine with the Ext4 file system has a SATA Samsung HD502HJ hard drive. Both hard drives spin at 7200 RPM and have hard drive write-caching enabled (using `hdparm -W 1 [device]`). The numbers reported below are the median of three measurements.</p>
  72. <h4>Benchmark Source Code</h4>
  73. <p>We wrote benchmark tools for SQLite and Kyoto TreeDB based on LevelDB's <span class="code">db_bench</span>. The code for each of the benchmarks resides here:</p>
  74. <ul>
  75. <li> <b>LevelDB:</b> <a href="http://code.google.com/p/leveldb/source/browse/trunk/db/db_bench.cc">db/db_bench.cc</a>.</li>
  76. <li> <b>SQLite:</b> <a href="http://code.google.com/p/leveldb/source/browse/#svn%2Ftrunk%2Fdoc%2Fbench%2Fdb_bench_sqlite3.cc">doc/bench/db_bench_sqlite3.cc</a>.</li>
  77. <li> <b>Kyoto TreeDB:</b> <a href="http://code.google.com/p/leveldb/source/browse/#svn%2Ftrunk%2Fdoc%2Fbench%2Fdb_bench_tree_db.cc">doc/bench/db_bench_tree_db.cc</a>.</li>
  78. </ul>
  79. <h4>Custom Build Specifications</h4>
  80. <ul>
  81. <li>LevelDB: LevelDB was compiled with the <a href="http://code.google.com/p/google-perftools">tcmalloc</a> library and the <a href="http://code.google.com/p/snappy/">Snappy</a> compression library (revision 33). Assertions were disabled.</li>
  82. <li>TreeDB: TreeDB was compiled using the <a href="http://www.oberhumer.com/opensource/lzo/">LZO</a> compression library (version 2.03). Furthermore, we enabled the TSMALL and TLINEAR options when opening the database in order to reduce the footprint of each record.</li>
  83. <li>SQLite: We tuned SQLite's performance, by setting its locking mode to exclusive. We also enabled SQLite's <a href="http://www.sqlite.org/draft/wal.html">write-ahead logging</a>.</li>
  84. </ul>
  85. <h2>1. Baseline Performance</h2>
  86. <p>This section gives the baseline performance of all the
  87. databases. Following sections show how performance changes as various
  88. parameters are varied. For the baseline:</p>
  89. <ul>
  90. <li> Each database is allowed 4 MB of cache memory.</li>
  91. <li> Databases are opened in <em>asynchronous</em> write mode.
  92. (LevelDB's sync option, TreeDB's OAUTOSYNC option, and
  93. SQLite3's synchronous options are all turned off). I.e.,
  94. every write is pushed to the operating system, but the
  95. benchmark does not wait for the write to reach the disk.</li>
  96. <li> Keys are 16 bytes each.</li>
  97. <li> Value are 100 bytes each (with enough redundancy so that
  98. a simple compressor shrinks them to 50% of their original
  99. size).</li>
  100. <li> Sequential reads/writes traverse the key space in increasing order.</li>
  101. <li> Random reads/writes traverse the key space in random order.</li>
  102. </ul>
  103. <h3>A. Sequential Reads</h3>
  104. <table class="bn bnbase">
  105. <tr><td class="c1">LevelDB</td>
  106. <td class="c2">4,030,000 ops/sec</td>
  107. <td class="c3"><div class="bldb" style="width:350px">&nbsp;</div></td>
  108. <tr><td class="c1">Kyoto TreeDB</td>
  109. <td class="c2">1,010,000 ops/sec</td>
  110. <td class="c3"><div class="bkct" style="width:95px">&nbsp;</div></td>
  111. <tr><td class="c1">SQLite3</td>
  112. <td class="c2">383,000 ops/sec</td>
  113. <td class="c3"><div class="bsql" style="width:33px">&nbsp;</div></td>
  114. </table>
  115. <h3>B. Random Reads</h3>
  116. <table class="bn bnbase">
  117. <tr><td class="c1">LevelDB</td>
  118. <td class="c2">129,000 ops/sec</td>
  119. <td class="c3"><div class="bldb" style="width:298px">&nbsp;</div></td>
  120. <tr><td class="c1">Kyoto TreeDB</td>
  121. <td class="c2">151,000 ops/sec</td>
  122. <td class="c3"><div class="bkct" style="width:350px">&nbsp;</div></td>
  123. <tr><td class="c1">SQLite3</td>
  124. <td class="c2">134,000 ops/sec</td>
  125. <td class="c3"><div class="bsql" style="width:310px">&nbsp;</div></td>
  126. </table>
  127. <h3>C. Sequential Writes</h3>
  128. <table class="bn bnbase">
  129. <tr><td class="c1">LevelDB</td>
  130. <td class="c2">779,000 ops/sec</td>
  131. <td class="c3"><div class="bldb" style="width:350px">&nbsp;</div></td>
  132. <tr><td class="c1">Kyoto TreeDB</td>
  133. <td class="c2">342,000 ops/sec</td>
  134. <td class="c3"><div class="bkct" style="width:154px">&nbsp;</div></td>
  135. <tr><td class="c1">SQLite3</td>
  136. <td class="c2">48,600 ops/sec</td>
  137. <td class="c3"><div class="bsql" style="width:22px">&nbsp;</div></td>
  138. </table>
  139. <h3>D. Random Writes</h3>
  140. <table class="bn bnbase">
  141. <tr><td class="c1">LevelDB</td>
  142. <td class="c2">164,000 ops/sec</td>
  143. <td class="c3"><div class="bldb" style="width:350px">&nbsp;</div></td>
  144. <tr><td class="c1">Kyoto TreeDB</td>
  145. <td class="c2">88,500 ops/sec</td>
  146. <td class="c3"><div class="bkct" style="width:188px">&nbsp;</div></td>
  147. <tr><td class="c1">SQLite3</td>
  148. <td class="c2">9,860 ops/sec</td>
  149. <td class="c3"><div class="bsql" style="width:21px">&nbsp;</div></td>
  150. </table>
  151. <p>LevelDB outperforms both SQLite3 and TreeDB in sequential and random write operations and sequential read operations. Kyoto Cabinet has the fastest random read operations.</p>
  152. <h2>2. Write Performance under Different Configurations</h2>
  153. <h3>A. Large Values </h3>
  154. <p>For this benchmark, we start with an empty database, and write 100,000 byte values (~50% compressible). To keep the benchmark running time reasonable, we stop after writing 1000 values.</p>
  155. <h4>Sequential Writes</h4>
  156. <table class="bn bnbase">
  157. <tr><td class="c1">LevelDB</td>
  158. <td class="c2">1,100 ops/sec</td>
  159. <td class="c3"><div class="bldb" style="width:234px">&nbsp;</div></td></tr>
  160. <tr><td class="c1">Kyoto TreeDB</td>
  161. <td class="c2">1,000 ops/sec</td>
  162. <td class="c3"><div class="bkct" style="width:224px">&nbsp;</div></td></tr>
  163. <tr><td class="c1">SQLite3</td>
  164. <td class="c2">1,600 ops/sec</td>
  165. <td class="c3"><div class="bsql" style="width:350px">&nbsp;</div></td></tr>
  166. </table>
  167. <h4>Random Writes</h4>
  168. <table class="bn bnbase">
  169. <tr><td class="c1">LevelDB</td>
  170. <td class="c2">480 ops/sec</td>
  171. <td class="c3"><div class="bldb" style="width:105px">&nbsp;</div></td></tr>
  172. <tr><td class="c1">Kyoto TreeDB</td>
  173. <td class="c2">1,100 ops/sec</td>
  174. <td class="c3"><div class="bkct" style="width:240px">&nbsp;</div></td></tr>
  175. <tr><td class="c1">SQLite3</td>
  176. <td class="c2">1,600 ops/sec</td>
  177. <td class="c3"><div class="bsql" style="width:350px">&nbsp;</div></td></tr>
  178. </table>
  179. <p>LevelDB doesn't perform as well with large values of 100,000 bytes each. This is because LevelDB writes keys and values at least twice: first time to the transaction log, and second time (during a compaction) to a sorted file.
  180. With larger values, LevelDB's per-operation efficiency is swamped by the
  181. cost of extra copies of large values.</p>
  182. <h3>B. Batch Writes</h3>
  183. <p>A batch write is a set of writes that are applied atomically to the underlying database. A single batch of N writes may be significantly faster than N individual writes. The following benchmark writes one thousand batches where each batch contains one thousand 100-byte values. TreeDB does not support batch writes and is omitted from this benchmark.</p>
  184. <h4>Sequential Writes</h4>
  185. <table class="bn">
  186. <tr><td class="c1">LevelDB</td>
  187. <td class="c2">840,000 entries/sec</td>
  188. <td class="c3"><div class="bldb" style="width:350px">&nbsp;</div></td>
  189. <td class="c4">(1.08x baseline)</td></tr>
  190. <tr><td class="c1">SQLite3</td>
  191. <td class="c2">124,000 entries/sec</td>
  192. <td class="c3"><div class="bsql" style="width:52px">&nbsp;</div></td>
  193. <td class="c4">(2.55x baseline)</td></tr>
  194. </table>
  195. <h4>Random Writes</h4>
  196. <table class="bn">
  197. <tr><td class="c1">LevelDB</td>
  198. <td class="c2">221,000 entries/sec</td>
  199. <td class="c3"><div class="bldb" style="width:350px">&nbsp;</div></td>
  200. <td class="c4">(1.35x baseline)</td></tr>
  201. <tr><td class="c1">SQLite3</td>
  202. <td class="c2">22,000 entries/sec</td>
  203. <td class="c3"><div class="bsql" style="width:34px">&nbsp;</div></td>
  204. <td class="c4">(2.23x baseline)</td></tr>
  205. </table>
  206. <p>Because of the way LevelDB persistent storage is organized, batches of
  207. random writes are not much slower (only a factor of 4x) than batches
  208. of sequential writes.</p>
  209. <h3>C. Synchronous Writes</h3>
  210. <p>In the following benchmark, we enable the synchronous writing modes
  211. of all of the databases. Since this change significantly slows down the
  212. benchmark, we stop after 10,000 writes. For synchronous write tests, we've
  213. disabled hard drive write-caching (using `hdparm -W 0 [device]`).</p>
  214. <ul>
  215. <li>For LevelDB, we set WriteOptions.sync = true.</li>
  216. <li>In TreeDB, we enabled TreeDB's OAUTOSYNC option.</li>
  217. <li>For SQLite3, we set "PRAGMA synchronous = FULL".</li>
  218. </ul>
  219. <h4>Sequential Writes</h4>
  220. <table class="bn">
  221. <tr><td class="c1">LevelDB</td>
  222. <td class="c2">100 ops/sec</td>
  223. <td class="c3"><div class="bldb" style="width:350px">&nbsp;</div></td>
  224. <td class="c4">(0.003x baseline)</td></tr>
  225. <tr><td class="c1">Kyoto TreeDB</td>
  226. <td class="c2">7 ops/sec</td>
  227. <td class="c3"><div class="bkct" style="width:27px">&nbsp;</div></td>
  228. <td class="c4">(0.0004x baseline)</td></tr>
  229. <tr><td class="c1">SQLite3</td>
  230. <td class="c2">88 ops/sec</td>
  231. <td class="c3"><div class="bsql" style="width:315px">&nbsp;</div></td>
  232. <td class="c4">(0.002x baseline)</td></tr>
  233. </table>
  234. <h4>Random Writes</h4>
  235. <table class="bn">
  236. <tr><td class="c1">LevelDB</td>
  237. <td class="c2">100 ops/sec</td>
  238. <td class="c3"><div class="bldb" style="width:350px">&nbsp;</div></td>
  239. <td class="c4">(0.015x baseline)</td></tr>
  240. <tr><td class="c1">Kyoto TreeDB</td>
  241. <td class="c2">8 ops/sec</td>
  242. <td class="c3"><div class="bkct" style="width:29px">&nbsp;</div></td>
  243. <td class="c4">(0.001x baseline)</td></tr>
  244. <tr><td class="c1">SQLite3</td>
  245. <td class="c2">88 ops/sec</td>
  246. <td class="c3"><div class="bsql" style="width:314px">&nbsp;</div></td>
  247. <td class="c4">(0.009x baseline)</td></tr>
  248. </table>
  249. <p>Also see the <code>ext4</code> performance numbers below
  250. since synchronous writes behave significantly differently
  251. on <code>ext3</code> and <code>ext4</code>.</p>
  252. <h3>D. Turning Compression Off</h3>
  253. <p>In the baseline measurements, LevelDB and TreeDB were using
  254. light-weight compression
  255. (<a href="http://code.google.com/p/snappy/">Snappy</a> for LevelDB,
  256. and <a href="http://www.oberhumer.com/opensource/lzo/">LZO</a> for
  257. TreeDB). SQLite3, by default does not use compression. The
  258. experiments below show what happens when compression is disabled in
  259. all of the databases (the SQLite3 numbers are just a copy of
  260. its baseline measurements):</p>
  261. <h4>Sequential Writes</h4>
  262. <table class="bn">
  263. <tr><td class="c1">LevelDB</td>
  264. <td class="c2">594,000 ops/sec</td>
  265. <td class="c3"><div class="bldb" style="width:350px">&nbsp;</div></td>
  266. <td class="c4">(0.76x baseline)</td></tr>
  267. <tr><td class="c1">Kyoto TreeDB</td>
  268. <td class="c2">485,000 ops/sec</td>
  269. <td class="c3"><div class="bkct" style="width:239px">&nbsp;</div></td>
  270. <td class="c4">(1.42x baseline)</td></tr>
  271. <tr><td class="c1">SQLite3</td>
  272. <td class="c2">48,600 ops/sec</td>
  273. <td class="c3"><div class="bsql" style="width:29px">&nbsp;</div></td>
  274. <td class="c4">(1.00x baseline)</td></tr>
  275. </table>
  276. <h4>Random Writes</h4>
  277. <table class="bn">
  278. <tr><td class="c1">LevelDB</td>
  279. <td class="c2">135,000 ops/sec</td>
  280. <td class="c3"><div class="bldb" style="width:296px">&nbsp;</div></td>
  281. <td class="c4">(0.82x baseline)</td></tr>
  282. <tr><td class="c1">Kyoto TreeDB</td>
  283. <td class="c2">159,000 ops/sec</td>
  284. <td class="c3"><div class="bkct" style="width:350px">&nbsp;</div></td>
  285. <td class="c4">(1.80x baseline)</td></tr>
  286. <tr><td class="c1">SQLite3</td>
  287. <td class="c2">9,860 ops/sec</td>
  288. <td class="c3"><div class="bsql" style="width:22px">&nbsp;</div></td>
  289. <td class="c4">(1.00x baseline)</td></tr>
  290. </table>
  291. <p>LevelDB's write performance is better with compression than without
  292. since compression decreases the amount of data that has to be written
  293. to disk. Therefore LevelDB users can leave compression enabled in
  294. most scenarios without having worry about a tradeoff between space
  295. usage and performance. TreeDB's performance on the other hand is
  296. better without compression than with compression. Presumably this is
  297. because TreeDB's compression library (LZO) is more expensive than
  298. LevelDB's compression library (Snappy).<p>
  299. <h3>E. Using More Memory</h3>
  300. <p>We increased the overall cache size for each database to 128 MB. For LevelDB, we partitioned 128 MB into a 120 MB write buffer and 8 MB of cache (up from 2 MB of write buffer and 2 MB of cache). For SQLite3, we kept the page size at 1024 bytes, but increased the number of pages to 131,072 (up from 4096). For TreeDB, we also kept the page size at 1024 bytes, but increased the cache size to 128 MB (up from 4 MB).</p>
  301. <h4>Sequential Writes</h4>
  302. <table class="bn">
  303. <tr><td class="c1">LevelDB</td>
  304. <td class="c2">812,000 ops/sec</td>
  305. <td class="c3"><div class="bldb" style="width:350px">&nbsp;</div></td>
  306. <td class="c4">(1.04x baseline)</td></tr>
  307. <tr><td class="c1">Kyoto TreeDB</td>
  308. <td class="c2">321,000 ops/sec</td>
  309. <td class="c3"><div class="bkct" style="width:138px">&nbsp;</div></td>
  310. <td class="c4">(0.94x baseline)</td></tr>
  311. <tr><td class="c1">SQLite3</td>
  312. <td class="c2">48,500 ops/sec</td>
  313. <td class="c3"><div class="bsql" style="width:21px">&nbsp;</div></td>
  314. <td class="c4">(1.00x baseline)</td></tr>
  315. </table>
  316. <h4>Random Writes</h4>
  317. <table class="bn">
  318. <tr><td class="c1">LevelDB</td>
  319. <td class="c2">355,000 ops/sec</td>
  320. <td class="c3"><div class="bldb" style="width:350px">&nbsp;</div></td>
  321. <td class="c4">(2.16x baseline)</td></tr>
  322. <tr><td class="c1">Kyoto TreeDB</td>
  323. <td class="c2">284,000 ops/sec</td>
  324. <td class="c3"><div class="bkct" style="width:280px">&nbsp;</div></td>
  325. <td class="c4">(3.21x baseline)</td></tr>
  326. <tr><td class="c1">SQLite3</td>
  327. <td class="c2">9,670 ops/sec</td>
  328. <td class="c3"><div class="bsql" style="width:10px">&nbsp;</div></td>
  329. <td class="c4">(0.98x baseline)</td></tr>
  330. </table>
  331. <p>SQLite's performance does not change substantially when compared to
  332. the baseline, but the random write performance for both LevelDB and
  333. TreeDB increases significantly. LevelDB's performance improves
  334. because a larger write buffer reduces the need to merge sorted files
  335. (since it creates a smaller number of larger sorted files). TreeDB's
  336. performance goes up because the entire database is available in memory
  337. for fast in-place updates.</p>
  338. <h2>3. Read Performance under Different Configurations</h2>
  339. <h3>A. Larger Caches</h3>
  340. <p>We increased the overall memory usage to 128 MB for each database.
  341. For LevelDB, we allocated 8 MB to LevelDB's write buffer and 120 MB
  342. to LevelDB's cache. The other databases don't differentiate between a
  343. write buffer and a cache, so we simply set their cache size to 128
  344. MB.</p>
  345. <h4>Sequential Reads</h4>
  346. <table class="bn">
  347. <tr><td class="c1">LevelDB</td>
  348. <td class="c2">5,210,000 ops/sec</td>
  349. <td class="c3"><div class="bldb" style="width:350px">&nbsp;</div></td>
  350. <td class="c4">(1.29x baseline)</td></tr>
  351. <tr><td class="c1">Kyoto TreeDB</td>
  352. <td class="c2">1,070,000 ops/sec</td>
  353. <td class="c3"><div class="bkct" style="width:72px">&nbsp;</div></td>
  354. <td class="c4">(1.06x baseline)</td></tr>
  355. <tr><td class="c1">SQLite3</td>
  356. <td class="c2">609,000 ops/sec</td>
  357. <td class="c3"><div class="bsql" style="width:41px">&nbsp;</div></td>
  358. <td class="c4">(1.59x baseline)</td></tr>
  359. </table>
  360. <h4>Random Reads</h4>
  361. <table class="bn">
  362. <tr><td class="c1">LevelDB</td>
  363. <td class="c2">190,000 ops/sec</td>
  364. <td class="c3"><div class="bldb" style="width:144px">&nbsp;</div></td>
  365. <td class="c4">(1.47x baseline)</td></tr>
  366. <tr><td class="c1">Kyoto TreeDB</td>
  367. <td class="c2">463,000 ops/sec</td>
  368. <td class="c3"><div class="bkct" style="width:350px">&nbsp;</div></td>
  369. <td class="c4">(3.07x baseline)</td></tr>
  370. <tr><td class="c1">SQLite3</td>
  371. <td class="c2">186,000 ops/sec</td>
  372. <td class="c3"><div class="bsql" style="width:141px">&nbsp;</div></td>
  373. <td class="c4">(1.39x baseline)</td></tr>
  374. </table>
  375. <p>As expected, the read performance of all of the databases increases
  376. when the caches are enlarged. In particular, TreeDB seems to make
  377. very effective use of a cache that is large enough to hold the entire
  378. database.</p>
  379. <h3>B. No Compression Reads </h3>
  380. <p>For this benchmark, we populated a database with 1 million entries consisting of 16 byte keys and 100 byte values. We compiled LevelDB and Kyoto Cabinet without compression support, so results that are read out from the database are already uncompressed. We've listed the SQLite3 baseline read performance as a point of comparison.</p>
  381. <h4>Sequential Reads</h4>
  382. <table class="bn">
  383. <tr><td class="c1">LevelDB</td>
  384. <td class="c2">4,880,000 ops/sec</td>
  385. <td class="c3"><div class="bldb" style="width:350px">&nbsp;</div></td>
  386. <td class="c4">(1.21x baseline)</td></tr>
  387. <tr><td class="c1">Kyoto TreeDB</td>
  388. <td class="c2">1,230,000 ops/sec</td>
  389. <td class="c3"><div class="bkct" style="width:88px">&nbsp;</div></td>
  390. <td class="c4">(3.60x baseline)</td></tr>
  391. <tr><td class="c1">SQLite3</td>
  392. <td class="c2">383,000 ops/sec</td>
  393. <td class="c3"><div class="bsql" style="width:27px">&nbsp;</div></td>
  394. <td class="c4">(1.00x baseline)</td></tr>
  395. </table>
  396. <h4>Random Reads</h4>
  397. <table class="bn">
  398. <tr><td class="c1">LevelDB</td>
  399. <td class="c2">149,000 ops/sec</td>
  400. <td class="c3"><div class="bldb" style="width:300px">&nbsp;</div></td>
  401. <td class="c4">(1.16x baseline)</td></tr>
  402. <tr><td class="c1">Kyoto TreeDB</td>
  403. <td class="c2">175,000 ops/sec</td>
  404. <td class="c3"><div class="bkct" style="width:350px">&nbsp;</div></td>
  405. <td class="c4">(1.16x baseline)</td></tr>
  406. <tr><td class="c1">SQLite3</td>
  407. <td class="c2">134,000 ops/sec</td>
  408. <td class="c3"><div class="bsql" style="width:268px">&nbsp;</div></td>
  409. <td class="c4">(1.00x baseline)</td></tr>
  410. </table>
  411. <p>Performance of both LevelDB and TreeDB improves a small amount when
  412. compression is disabled. Note however that under different workloads,
  413. performance may very well be better with compression if it allows more
  414. of the working set to fit in memory.</p>
  415. <h2>Note about Ext4 Filesystems</h2>
  416. <p>The preceding numbers are for an ext3 file system. Synchronous writes are much slower under <a href="http://en.wikipedia.org/wiki/Ext4">ext4</a> (LevelDB drops to ~31 writes / second and TreeDB drops to ~5 writes / second; SQLite3's synchronous writes do not noticeably drop) due to ext4's different handling of <span class="code">fsync</span> / <span class="code">msync</span> calls. Even LevelDB's asynchronous write performance drops somewhat since it spreads its storage across multiple files and issues <span class="code">fsync</span> calls when switching to a new file.</p>
  417. <h2>Acknowledgements</h2>
  418. <p>Jeff Dean and Sanjay Ghemawat wrote LevelDB. Kevin Tseng wrote and compiled these benchmarks. Mikio Hirabayashi, Scott Hess, and Gabor Cselle provided help and advice.</p>
  419. </body>
  420. </html>