tikv/tikv

Migrate to tower-grpc

brson opened this issue · 4 comments

brson commented

The gRPC stack tikv is on is unloved and it looks like the future of gRPC in Rust is https://github.com/tower-rs/tower-grpc. Let's start migrating in that direction.

There will be many unknowns here, upstream contributions needed, benchmarking, careful regression testing.

This is a great idea! Hope @carllerche can help us :-)

If we really want to do this, at first, I guess we need to do a benchmark comparing the C gRPC and tower gRPC.

To add tower-rs to TiKV, we may:

  1. Generate the related server code with tower gRPC from our proto kvproto.
  2. Add a new port for TiKV (maybe 20181) for the tower gRPC so both two gRPC can run at the same time.
  3. Try to support some basic APIs like RawPut, RawGet.
  4. Try to let two TiKV communicate through tower gRPC. We can assume that if the remote TiKV port is 20160, the tower port is 20161(20160 + 1)

For 3 and 4, maybe the most problem for us is how to handle two different protobuf libraries, now we heavily depend on rust-protobuf, but tower uses prost, migrating to prost will change lots of code and take a long time.

brson commented

@ice1000 I've unassigned myself since I don't think I'll be involved in this.

I think at first we can migrate rust-protobuf to prost, then we can try tower-grpc easily.