/kafka4rust

Kafka client in Rust

Primary LanguageRust

Kafka client (personal project, work in progress)

Features

  • IPv6 support
  • Instrumentation
  • Tokio
  • Serde
  • Recovery
    • Producer
    • Consumer
    • Timeout
  • Client API
    • Producer
    • Consumer
    • Compression
    • Headers
    • Admin
    • Transactions
    • SSL
  • Integration testing
    • Test with different executors (std-async, tokio)
  • Open Tracing
    • Use crate::tracing
  • Decide on error strategy. Use dynamic error?
  • Migrate off failure crate
    • enum + impl Error manually (in library)
    • anyhow (recommended by withoutboats)
    • thiserror
    • eyre
    • snafu

TODO

Techniques

  • Try parallel-streams
  • Consider Cow<> when deserializing.
  • Consider flume for channels
  • Considr dashmap for mutithreading access.
  • Consider slotmap https://docs.rs/slotmap/1.0.1/slotmap/
  • Consider parking_lot for non-poisoning locks.
  • Consider tinyvec and smolstr for stack-optimized strings/arrays
  • Consider using arena: https://manishearth.github.io/blog/2021/03/15/arenas-in-rust/
  • Audit that copy is used whenever possible, instead of clone
  • Tcp: nodelay, experiment with tx,rx buffer size
  • Adaptive buffer size
  • Trained dictionary for lz4
  • Stats about producer/consumer buffers waiting, server throttling
  • CI: do cargo audit
  • Failure model: fail up to connection reset instead of panic.
  • Use hashmap's raw_entry
    • Is unstable
  • Try Async Local Executors
  • futures-concurrency
  • Glommio and Monoio are not Send and use a "thread-per-core" design

Projects

  • Wireshark decoder
  • Compaction and record batch analyzer
  • Enterprise UI
  • FS adapter
  • Server-side filtering

Resources:

https://matklad.github.io/2020/10/15/study-of-std-io-error.html https://willcrichton.net/rust-api-type-patterns/ https://aturon.github.io/blog/2015/08/27/epoch/ https://ryhl.io/blog/actors-with-tokio/