GithubHelp home page GithubHelp logo

kafka-consumer's People

Contributors

wvanbergen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

kafka-consumer's Issues

Auto Rebalancing Issue

Hi,

I was trying this gem, which is mostly really good. But when I tried to add more processes into the consumer groups, partitions are not automatically rebalanced / redistributed.

Steps I took:

  1. I had 40-partition topic on a one-broker Kafka testing server;
  2. Start a consumer group A in one server; monitoring shows that this consumer group is fully functional, taking over all partitions;
  3. 2 minutes later, start a new consumer group B with same group id in another server. I expect the distribution of partitions should be auto balanced between this two consumer group. But it's not. What the group B shows are:
I, [2015-11-10T21:38:01.779225 #17898]  INFO -- : Registered for my_high_level_consumer as ip-10-2-13-56:5c975c69-a251-4a52-9a6f-79738ba09f0c
I, [2015-11-10T21:38:01.781026 #17898]  INFO -- : 2 instances have been registered: ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0, ip-10-2-13-56:5c975c69-a251-4a52-9a6f-79738ba09f0c.
I, [2015-11-10T21:38:01.781332 #17898]  INFO -- : Claiming 20 out of 40 partitions.
I, [2015-11-10T21:38:01.781441 #17898]  INFO -- : Starting 20 new partition consumers.
D, [2015-11-10T21:38:01.791024 #17898] DEBUG -- : Suspended consumer manager thread.
I, [2015-11-10T21:38:01.791084 #17898]  INFO -- : Claiming partition h_c_topic/20...
I, [2015-11-10T21:38:01.791183 #17898]  INFO -- : Claiming partition h_c_topic/21...
I, [2015-11-10T21:38:01.791251 #17898]  INFO -- : Claiming partition h_c_topic/22...
I, [2015-11-10T21:38:01.791308 #17898]  INFO -- : Claiming partition h_c_topic/23...
I, [2015-11-10T21:38:01.791361 #17898]  INFO -- : Claiming partition h_c_topic/24...
I, [2015-11-10T21:38:01.791414 #17898]  INFO -- : Claiming partition h_c_topic/25...
I, [2015-11-10T21:38:01.791467 #17898]  INFO -- : Claiming partition h_c_topic/26...
I, [2015-11-10T21:38:01.791528 #17898]  INFO -- : Claiming partition h_c_topic/27...
I, [2015-11-10T21:38:01.791589 #17898]  INFO -- : Claiming partition h_c_topic/28...
I, [2015-11-10T21:38:01.791649 #17898]  INFO -- : Claiming partition h_c_topic/29...
I, [2015-11-10T21:38:01.791711 #17898]  INFO -- : Claiming partition h_c_topic/30...
I, [2015-11-10T21:38:01.791772 #17898]  INFO -- : Claiming partition h_c_topic/31...
I, [2015-11-10T21:38:01.791832 #17898]  INFO -- : Claiming partition h_c_topic/32...
I, [2015-11-10T21:38:01.791894 #17898]  INFO -- : Claiming partition h_c_topic/33...
I, [2015-11-10T21:38:01.791955 #17898]  INFO -- : Claiming partition h_c_topic/34...
I, [2015-11-10T21:38:01.792016 #17898]  INFO -- : Claiming partition h_c_topic/35...
I, [2015-11-10T21:38:01.792076 #17898]  INFO -- : Claiming partition h_c_topic/36...
I, [2015-11-10T21:38:01.792137 #17898]  INFO -- : Claiming partition h_c_topic/37...
I, [2015-11-10T21:38:01.792197 #17898]  INFO -- : Claiming partition h_c_topic/38...
I, [2015-11-10T21:38:01.792259 #17898]  INFO -- : Claiming partition h_c_topic/39...
W, [2015-11-10T21:38:01.793483 #17898]  WARN -- : Partition h_c_topic/21 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.793644 #17898]  WARN -- : Partition h_c_topic/20 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.794308 #17898]  WARN -- : Partition h_c_topic/22 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.795232 #17898]  WARN -- : Partition h_c_topic/23 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.796199 #17898]  WARN -- : Partition h_c_topic/24 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.797034 #17898]  WARN -- : Partition h_c_topic/25 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.797386 #17898]  WARN -- : Partition h_c_topic/27 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.797602 #17898]  WARN -- : Partition h_c_topic/26 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.797671 #17898]  WARN -- : Partition h_c_topic/28 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.797849 #17898]  WARN -- : Partition h_c_topic/29 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.798054 #17898]  WARN -- : Partition h_c_topic/30 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.798231 #17898]  WARN -- : Partition h_c_topic/31 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.798475 #17898]  WARN -- : Partition h_c_topic/32 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.798731 #17898]  WARN -- : Partition h_c_topic/33 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.798953 #17898]  WARN -- : Partition h_c_topic/34 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.799178 #17898]  WARN -- : Partition h_c_topic/35 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.799581 #17898]  WARN -- : Partition h_c_topic/37 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.799803 #17898]  WARN -- : Partition h_c_topic/38 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.799866 #17898]  WARN -- : Partition h_c_topic/36 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...
W, [2015-11-10T21:38:01.799982 #17898]  WARN -- : Partition h_c_topic/39 is still claimed by instance ip-10-2-13-59:ba7067cd-eddb-4bd7-9ae1-bdb24b696cd0. Waiting for the claim to be released...

and it was just permanently stuck in there and not moving forward. In the meantime, group A actually lost the control of half of the partitions (partition 20 to partition 39) while group B still didn't get this half.

Consumer code i'm using for both group A and B is (nothing really fancy):

require 'kafka-consumer'
consumer = Kafka::Consumer.new('my_high_level_consumer', ['h_c_topic'], zookeeper: '10.2.13.244:2181', max_wait_ms: 2000, initial_offset: -2)
Signal.trap("INT") { consumer.interrupt }
count = 0
consumer.each do |message|
  count += 1
  $stdout.puts "received message: partition => #{message.partition}, offset => #{message.offset}, msg => #{message.value}"
  $stdout.flush if count % 50 == 0
end

Was it supposed to be like this by design? Or was it something wrong?

Thanks,

Mingwei

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.