-
Notifications
You must be signed in to change notification settings - Fork 594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
spring.cloud.stream.instanceCount and Autoscaling #1342
Comments
@steve-roy can you please be a bit more specific with regard to what you're trying to achieve? |
For example, we will be running our Kafka Consumer / Producer in an Amazon Autoscaling environment. Let's call our Spring Boot / Cloud Stream application CP. When load is light we might be running one instance of CP. In this case, if we understand the use of the settings they would be: During heavy activity, we might ask Amazon to increase the application instance count of CP based on rules we define. Let's say Amazon increases the instances to 3. In this case, the settings would be: CP1 CP2 CP3 Because, the code is a pre-built jar and deployed we can't update the properties in the jar. Questions:
Does this help?
|
Also, looks like this issue was previously opened and then closed but the resolution is not clear. |
They are used for binder-based partitioning (when using a binder which, unlike Kafka, doesn't support partitioning natively). With Kafka, the instanceCount is also used (along with concurrency) to check if the topic has enough partitions (count * concurrency), and adjust them up, if so configured (autoAddPartitions). Similarly, the instance index is used for partitioned consumers; again, not necessary with Kafka as long as Kafka group management is used, so that Kafka allocates partitions to instances. Some environments (PCF, k8s - with the SCDF deployer) allocate an instance index automatically. |
ok - to confirm - if we are using Kafka with Consumer Groups these two properties are not required: spring.cloud.stream.instanceCount= |
Correct. But you need to make sure you have sufficient partitions for your topics to support the scale-out you desire, because the binder won't attempt to increase them. |
understood - thank you. Are you able to comment on the Kinesis Spring Cloud Stream binder? Are the properties required with the Kinesis Spring Cloud Stream binder? https://github.com/spring-cloud/spring-cloud-stream-binder-aws-kinesis |
No, those properties are not required on Kinesis as well.
So, if you specify them, each Does it make sense to you? |
ok - thank you both for confirming. |
Hey @artembilan, I was exactly looking for this. So, from your explanation, with
However, I'm still not clear on this:
will instance1 and instance2 process 2 shards each ? Also, what happens when I change Thanks, |
Unfortunately an even distribution still doesn't work for Kinesis Binder: spring-projects/spring-integration-aws#99. However if you use
Please, consider in the future to ask questions on StackOverflow and don't comment on closed issues. There is a chance it is going to be lost. |
are these properties required for the rabbitmq binder? |
Yes; the rabbit binder does not support auto-scaling with partitioned queues. |
thanks, so I guess in k8s I should move from Deployment to StatefulSet and compute index and count in an init container before I can try and setup HPA |
Hi,
Are these properties required for proper function?
spring.cloud.stream.instanceCount
spring.cloud.stream.instanceIndex
If so, how are these expected to be set in an autoscaling environment?
The text was updated successfully, but these errors were encountered: