ArticleslgStudy

computer science

LevelDB

LevelDB is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand LevelDB rather than just read about it. In short: LevelDB is an open-source on-disk key-value store written by Google fellows Jeffrey Dean and Sanjay Ghemawat. Inspired by Bigtable, LevelDB source code is hosted on GitHub under the New BSD License and has been ported to a variety of Unix-based systems, macOS, Windows, and Android.

Key takeaways

  • LevelDB belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect LevelDB to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of LevelDB from memory before moving on to harder problems.

Reference excerpt

LevelDB is an open-source on-disk key-value store written by Google fellows Jeffrey Dean and Sanjay Ghemawat. Inspired by Bigtable, LevelDB source code is hosted on GitHub under the New BSD License and has been ported to a variety of Unix-based systems, macOS, Windows, and Android.

Features LevelDB stores keys and values in arbitrary byte arrays, and data is sorted by key. It supports batching writes, forward and backward iteration, and compression of the data via Google's Snappy compression library. LevelDB is not an SQL database. Like other NoSQL and dbm stores, it does not have a relational data model and it does not support SQL queries. It has no support for indexes. Applications use LevelDB as a library, as it does not provide a server or command-line interface. MariaDB 10.0 comes with a storage engine which allows users to query LevelDB tables from MariaDB.

History LevelDB is based on concepts from Google's Bigtable database system. The table implementation for the Bigtable system was developed starting in about 2004, and is based on a different Google internal code base than the LevelDB code. That code base relies on a number of Google code libraries that are not themselves open sourced, so directly open sourcing that code would have been difficult. Jeff Dean and Sanjay Ghemawat wanted to create a system resembling the Bigtable tablet stack that had minimal dependencies and would be suitable for open sourcing, and also would be suitable for use in Chrome for the IndexedDB implementation. They wrote LevelDB starting in early 2011, with the same general design as the Bigtable tablet stack, but not sharing any of the code.

Usage LevelDB is used as the backend database for Google Chrome's IndexedDB and is one of the supported backends for Riak. Additionally, Bitcoin Core and go-ethereum store the blockchain metadata using a LevelDB database. Minecraft Bedrock Edition uses a modified version for chunk and entity data storage. Autodesk AutoCAD 2016 also uses LevelDB.

Performance Google has provided benchmarks comparing LevelDB's performance to SQLite and Kyoto Cabinet in different scenarios. LevelDB outperforms both SQLite and Kyoto Cabinet in write operations and sequential-order read operations. LevelDB also excels at batch writes, but is slower than SQLite when dealing with large values. The currently published benchmarks were updated after SQLite configuration mistakes were noted in an earlier version of the results. Updated benchmarks show that LevelDB also outperforms Berkeley DB, but these tests also show that OpenLDAP LightningDB is much faster (~10 times in some scenarios) in read operations and some write types (e.g. batch and synchronous writes, see the link above), and is almost equal in the rest of the test. All the above benchmarks date back from 2011 to 2014, and may only be of historical significance as SQLite, for instance, became significantly more efficient.

Bugs and reliability LevelDB has a history of database corruption bugs. A study from 2014 has found that, on non-checksummed file systems, the database could become corrupted after a crash or power failure.

See also Ordered Key-Value Store

References

External links Official website

Worked examples

Example 1 — a first encounter with LevelDB

Start with the simplest possible case. Write down what LevelDB claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to LevelDB before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about LevelDB ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of LevelDB

In research
LevelDB appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses LevelDB in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
LevelDB is common in secondary-school and first-year university syllabi. It links to neighbouring topics 2011 software, Bigtable implementations, C++ libraries, so understanding it makes those chapters shorter.
In everyday life
Look for LevelDB outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “LevelDB” →

How to study LevelDB in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what LevelDB means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain LevelDB out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is LevelDB in simple terms?

LevelDB is an open-source on-disk key-value store written by Google fellows Jeffrey Dean and Sanjay Ghemawat. Inspired by Bigtable, LevelDB source code is hosted on GitHub under the New BSD License and has been ported to a variety of Unix-based systems, macOS, Windows, and Android.

Why does LevelDB matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study LevelDB?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on LevelDB.

Tags

  • 2011 software
  • Bigtable implementations
  • C++ libraries
  • Database engines
  • Embedded databases
  • Google software
  • Key-value databases
  • NoSQL
  • Ordered Key-Value Store
  • Software using the BSD license

Keep exploring