Comments (12)
This is a requirement for some work I'm about to do. I'm new to Rust (coming from Java/Scala + Kafka background) but I could take a stab at this unless you're already working on it.
from kafka-rust.
hello @datariot, it wasn't a priority for me right now, but i could give it precedence since the changes will have impact on other issues i planed to resolve. unfortunately, this will include some public api changes, though not as big as in the last 0.2 release.
from kafka-rust.
I feel partitioning by key is a pretty important part of a scalable Kafka project, so if it's going to impact other things it might be good to prioritize. Also it would selfishly help me ;-)
from kafka-rust.
@datariot i just pushed two very experimental commits to branch consistent-partitioning allowing the partitioner to obtain the total partition count for a topic. this would allow you to implement consistent hashing in your own, custom partitioner. feel free to experiment with it. please note, this is really just a very first draft and i surely don't want to promise this API will be preserved (but it's going to be something like that.)
from kafka-rust.
Hello @datariot,
so I took some the time to get this done. Can you review/try out branch consistent-partitioning? I'd be greatly interested in feedback.
So far, I've chosen SipHash
since that is part of the std library, so no extra dependencies are required. However, I managed to provide the possibility for a user to define a different hash implementation through the pubilc API of the producer::DefaultPartitioner
. This can give us room for experiments until we make a definite choice. So far I've looked, it seems xxhash
might be a better alternative. (fnv
is probably the fastest if one's keys are short - but that would be a bad default choice from our perspective, I think.) Do you have any opinions/suggestions on this?
Hope this works as expected. P.
from kafka-rust.
Awesome @xitep! I'll try to set aside some time today or tomorrow to check this out.
from kafka-rust.
@datariot have you had already a chance to play around with this so far? just curious.
from kafka-rust.
@xitep yes, this is working as expected. I haven't put it under load so I don't have an idea on how SipHash performs. We usually partition on a String that is between 10-30 chars long.
from kafka-rust.
@datariot many thanks for the confirmation. i'll merge the PR then. regarding SipHash i think it's fine enough as a default.
from kafka-rust.
so it's in master now. however, in the end i decided to release it as part of 0.3.0, after implementing a few more issues. feel free to re-open in case of troubles. and many thanks so far.
from kafka-rust.
Re-opening until this gets released with 0.3.0.
from kafka-rust.
Closing this one; just released 0.3.0.
from kafka-rust.
Related Issues (20)
- windows-gnu target compilation [Question] HOT 1
- "for ms in consumer.poll().unwrap().iter()" produces temporary value error HOT 3
- v0.8.0 is pointing to error-chain = "0.10" that is creating an error HOT 3
- [Feature request] Support for rebalancing and heartbeat HOT 8
- [Feature] Versions handling HOT 8
- How to get message timestamp HOT 2
- Consumers of the same group consuming same partitions and getting same messages HOT 1
- Sending message with headers HOT 2
- Version 0.9 HOT 2
- TLS max record size
- How to get the offset of the last message in a partition?
- is this repo being maintained? HOT 6
- Failed to debug from VSCode after added kafka client references. ("Unknown error (Open 'launch.json'" when F5)
- commit_consumed RequestTimedOut
- Consume from Latest
- UnknowTopicOrPartitiion Error
- See message headers
- how to create and delete topic with kafka-rust
- Two consumers both can receive the same message with same group and topic HOT 1
- How to connect using credentials, like username and password? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kafka-rust.