This Month in TiKV - July 2019

Nick Cameron

August 7, 2019


Hi! Welcome to the first ever edition of ‘This Month in TiKV’, covering July 2019. As the name suggests, this is a monthly newsletter covering interesting things happening in the world of TiKV, an open-source, distributed key-value store.

We’re just getting started with the newsletter, and you should expect it to evolve as we go along. We hope to cover news and events of interest to TiKV contributors and users, significant PRs and issues in the TiKV repo, and generally keep you informed of what is going on. Since this is the first issue we’ll cover a few bits of news from before July.

You’ll find the newsletter on the TiKV blog from the first week of each month.

Let us know what you think!

News

We released version 3.0 of TiKV! This was a huge and exciting release, and is accompanied by the 3.0 release of TiDB.

Jepsen tested TiDB and TiKV in a detailed analysis. This focused on transaction guarantees and failure testing.

In other news, PingCAP also released 1.0 of TiDB Operator, a tool for deploying TiDB in the cloud. Release announcement in English and Chinese

Reading material

Some blog posts and articles related to TiKV:

Current projects

There’s lots going on in the TiKV ecosystem. Here we’ll try to highlight some of the interesting projects.

Performance

There’s ongoing work to measure and improve TiKV’s performance in all areas. We’ve been making heavy use of tools like Intel Vtune and flame graph to find the slowest parts of TiKV. We hope to report more on specifics soon.

Titan

Titan is a storage engine plugin which improves on RocksDB. It is part of TiKV already and you can try it out by following these instructions. We’re working to improve its performance and stability. You can read more in this blog post.

Docs

We are currently migrating our documentation from the TiKV’s wiki to the official website. We’ll also be refactoring much of our documentation over the coming months. If you feel something is lacking please let us know!

Replica read

Replica read allows a database to read from a Raft follower, not just the leader. This greatly improves read performance when the client is close to a follower, but far from the leader (e.g., in different data centres). This feature is implemented in TiKV and we are working on adding support to TiDB.

Protobuf implementation

We’re experimenting with different implementations of Protocol Buffers (which underpin all our RPC communication). We’ve added support for Prost to our supporting libraries, and are working on adding support to TiKV.

Testing and stability

We’re working on making testing more reliable, adding long-running tests to our CI, and monitoring performance.

Adding RPN functions

TiKV supports executing SQL functions on the database using its coprocessor. We’ve been working to support RPN (reverse polish notation) functions, which are an optimisation technique for coprocessor. In the past month we’ve added support for coalesce, in, case_when, if, abs, multiply, divide, and date_format. There is more information about implementing coprocessor functions.

Rust client

We’re working on implementing a client library for TiKV in Rust. This will support very high performance TiKV clients.

Compile times

Waiting for code to compile is a pain, and TiKV can take quite a while to compile (especially in release mode). We’ve been working hard to improve that, for example in #4996.

RFCs

RFCs (Request For Comments) are how the TiKV team engages with the wider community to do open design of new features and major changes.

Currently, the RFCs for a Rust client and a command line client are in the final stages of discussion. There is also an interesting RFC to add a dedicated thread to TiKV for reading from the local raftstore, which is almost ready to be accepted.

Notable PRs

In PR 5041, we added support for Mimalloc, a new allocator from Microsoft. You currently have to opt-in to use it using MIMALLOC=1 when building. Benchmarking has been inconclusive so far.

In PR 5155, we created a new crate inside the tikv repository called tidb_query, it contains large parts of the coprocessor which have been moved from src/coprocessor/dag. The PR also renames the cop_xxx crates to tidb_query_xxx. Due to increased parallelism, this improves compile times by up to 25%.

In PR 5036 the tikv importer was moved out of the tikv repository and into its own repository.

Notable issues

When running TiKV on older CPUs, a sigill could be triggered originating in Titan. This has been fixed on master and will be fixed in the next point release. In the meantime, you can resolve this issue by building from source. Issue 4999.

New contributors

We’d like to welcome the following new contributors to TiKV and thank them for their work!

If you’d like to get involved, we’d love to help you get started. You might be interested in tackling one of these issues. If you don’t know how to begin, please leave a comment and somebody will help you out. We’re also very keen for people to contribute documentation, tests, optimizations, benchmarks, refactoring, or other useful things.

This Week in TiDB

For more rapid and detailed information about TiKV progress, PingCAP publishes weekly updates about TiDB and TiKV. The following cover July,