WEBVTT 00:04.240 --> 00:10.300 So far, there are few partitions in our topic numbers, and there are currently three different consumers 00:10.300 --> 00:12.210 running here, here and here. 00:12.730 --> 00:19.900 And now let's try to increase quantity of consumers to six that will be larger than quantity of partitions 00:20.080 --> 00:24.800 and see what will happen and how partitions will be reassigned to different consumers. 00:25.150 --> 00:31.870 So let's copy our command that will start a new consumer in a group, NOM's, and let's open up three 00:31.870 --> 00:35.530 more tabs like this city to Kafka. 00:36.650 --> 00:37.880 Launch consumer. 00:39.160 --> 00:43.560 Do I get him open up one more step to Afkham? 00:45.400 --> 00:51.340 Start one more consumer, and at the moment there are five consumers running that is equal to quantity 00:51.340 --> 00:53.310 of partitions in topic numbers. 00:53.410 --> 00:59.800 And before starting one more consumer, let's go to group the Dales and read them and see how partitions 00:59.800 --> 01:02.170 are now assigned to different consumers. 01:02.620 --> 01:07.960 And you could guess that every consumer should be assigned to just single partition. 01:08.110 --> 01:09.580 And yes, that is the case. 01:09.790 --> 01:17.560 I see here five different consumer ideas, and that means that every partition is assigned to separate 01:17.560 --> 01:21.800 consumer with separate consumer ID and it is completely fair. 01:22.030 --> 01:27.460 There are five consumers in the same group and that's the way each of those consumers gift, just a 01:27.460 --> 01:28.510 single partition. 01:28.840 --> 01:38.680 And if I produce some additional messages now, let's say 14, 15, 16, 17, 18, then all those messages 01:38.680 --> 01:45.730 will be spread across different partitions and every consumer will get some of those messages because 01:45.730 --> 01:49.000 every consumer is assigned to a single partition. 01:49.570 --> 01:56.820 OK, let's now try to start one more consumer in the same group and see whether a picture here in this 01:56.830 --> 01:58.660 column will be changed or not. 01:59.330 --> 02:02.500 So let's open up New Tab City to COFCO. 02:03.590 --> 02:06.040 And start one more consumer here. 02:07.490 --> 02:15.620 Let's drag it here and let's know details about our consumer group, NOM's Rexach U.S. Command. 02:16.550 --> 02:18.450 And I see a different picture. 02:18.560 --> 02:25.580 And as you may notice, politicians were reassigned to different consumers and for example, this consumer 02:25.580 --> 02:32.780 with this idea that ends with fifty five was before assigned to partition one, but now it is assigned 02:32.780 --> 02:33.870 to partition two. 02:34.010 --> 02:35.720 So here was this assignment. 02:36.200 --> 02:42.580 Also, you may see that in my case, the consumer with this idea that ends with five, four, six was 02:42.590 --> 02:44.390 disappeared here from this list. 02:44.810 --> 02:48.470 And that means that this consumer is no idle. 02:48.710 --> 02:51.200 It does not connect to any of the partitions. 02:51.800 --> 02:59.810 But if any of those consumers will stop, then this consumer with this idea will start consumption instead 02:59.810 --> 03:00.290 of it. 03:00.740 --> 03:02.510 So this is actually a redundancy. 03:02.900 --> 03:09.650 But as you may see from this output, main outcome is that if quantity of consumers in a consumer group 03:09.650 --> 03:17.630 is larger than quantity of partitions, then some of the consumers will be idle and they will protest 03:17.630 --> 03:23.720 any of the messages, this idea behind distribution of partitions across different consumers. 03:23.810 --> 03:29.870 And if, for example, you create a topic with, let's say, three partitions, but start one hundred 03:29.870 --> 03:37.460 consumers in a group, then ninety seven of those consumers will be simply idle and won't process any 03:37.460 --> 03:43.490 single message because maximum, in case you have only three partitions, only three consumers in a 03:43.490 --> 03:44.970 group may be active. 03:45.860 --> 03:51.020 Let's not try to stop one of consumers and see whether a picture will be changed here. 03:51.290 --> 03:53.750 So let's stop, for example, this one. 03:53.780 --> 04:01.010 You can stop any of six consumers and the go back here to this step and execute this command and rary 04:01.020 --> 04:03.050 details about consumer group. 04:03.350 --> 04:10.160 And I see that in my case, this consumer with this idea that was active at this moment of time and 04:10.160 --> 04:14.540 has disappeared here from the list is now again active. 04:14.540 --> 04:16.690 And here you see this assignment. 04:16.880 --> 04:19.780 Now it is assigned to partition with a default. 04:20.300 --> 04:28.510 But on the other hand, consumer with added that the ends with zero e this one in my case has disappeared. 04:28.730 --> 04:34.820 And does the consumer that I have stopped here in this step, that's how we have just ruled on practice, 04:34.880 --> 04:39.530 how idle consumers back to work if there was empty space for them. 04:39.950 --> 04:42.620 Let's not stop one more consumer, for example. 04:42.620 --> 04:44.090 This one, let's stop it. 04:44.420 --> 04:45.870 Go by here, Rorem. 04:46.040 --> 04:50.870 And now we should see that the one consumer is assigned to two different partitions. 04:50.870 --> 04:58.460 And yes, here was this consumer with this idea, because now I have only four consumers and five partitions. 04:58.730 --> 05:03.860 That's why two partitions must be assigned to a single consumer grade. 05:04.070 --> 05:10.370 That's how consumers work in a consumer group, and that's how partitions are assigned to different 05:10.370 --> 05:15.500 consumers in the same group as you see from this example in all outward. 05:15.500 --> 05:22.370 So we've got like equal to zero, and that means that all consumers are able to consume all just in 05:22.370 --> 05:22.730 time. 05:22.910 --> 05:27.940 And there is no difference between current offset and look and of set numbers. 05:28.220 --> 05:31.820 And the reason for that is that we have produced just several messages. 05:32.090 --> 05:37.970 But if quantity of messages that are produced by producers is much, much higher and consumers are not 05:37.970 --> 05:42.620 able to get all just in time, then here you'll see it non-zero numbers. 05:42.800 --> 05:45.380 And that's what we will try in the next example. 05:45.800 --> 05:49.520 But for now, let's quickly summarize what we explored in this example. 05:49.670 --> 05:51.320 But let's do that next by by.