GithubHelp home page GithubHelp logo

Comments (5)

xitep avatar xitep commented on June 9, 2024

hello,

i did some work on "unpacking" snappy compressed messages in kafka-rust and feel confident to provide an answer here.

first of all, kafka-rust is bound to the format spilled out by SnappyOutputStream which is used at least by Kafka 0.8.2.x. this is basically a concatenation of snappy compressed blocks - unfortunately not snappy frames.

  • so far i can see, we cannot use snappy_framed at the moment due to the format of the compressed data Kafka produces.
  • snappy is a thin ffi wrapper around the c/c++ library which is exactly what kafka-rust does. in other words, with some minor changes this library could in fact be used as a drop-in replacement for the corresponding code in kafka-rust. however, in branch-0.2.x - hopefully to be released in a few weeks - i extended the core decompression function a little bit to avoid some extra copying. so far, i'm quite OK with the performance. however, such changes could be intergrated into snappy, of course. for me, snappy looks like a good candidate.
  • i have not looked in detail at rsnappy yet, but right now it seems to me like it provides an API which would be suitable to us. the fact it's written in rust is indeed very interesting. i might have some experiments with it.

if you'd like to experiment yourself, feel free to go ahead and submit a pull request. for decompressing snappy messages we have unit tests as well as benchmarks (requires rust nightly) set up in master as well as the already mentioned branch-0.2.x.

from kafka-rust.

xitep avatar xitep commented on June 9, 2024
  1. merely replacing the existing snappy decompression code in kafka-rust with rsnappy leads to benchmarks indicating a performance loss by a factor of two to three on my machine. but it might well be i've not used rsnappy effectively.

  2. further it seems, that rsnappy is not very robust against invalid input data.

  3. i've pushed the changes to the rsnappy branch for the moment.

@veddan do you have any measurements comparing the performance of rsnappy to https://github.com/google/snappy ?

from kafka-rust.

xitep avatar xitep commented on June 9, 2024

fyi: once JeffBelgum/rust-snappy#1 is merged and released, we'll switch over to that snappy crate to get rid of our own snappy native bindings. the corresponding changes to kafka-rust are prepared in the external-snappy-dep branch for the moment.

from kafka-rust.

xitep avatar xitep commented on June 9, 2024

Switched over to the snappy crate with 930efc9. This change will be released as part of 0.2, since it requires an update of the libc dependency.

from kafka-rust.

xitep avatar xitep commented on June 9, 2024

just pushed version 0.2.0 to crates.io with a dependency on snappy:0.3.0. feel free to re-open if there's anything left from your side.

from kafka-rust.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.