awslabs / amazon-kinesis-client

Client library for Amazon Kinesis
Apache License 2.0
635 stars 461 forks source link

Am I degrading my app if use multiple KCL at the same time? #1305

Closed gabrielfmagalhaes closed 3 months ago

gabrielfmagalhaes commented 3 months ago

Hello everyone, I'm sorry if this is not the right place to discuss this, so please let me know if there's a right way to ask this I have one application with three different KCL running at the same time (yes, I managed to do it), but I was wondering if this is a good thing or if I should always aim for a 1-1 scenario like 1 Application should have only one KCL running and listening to a stream

Also, should I expect some degradation? Where? For instance, expect rate exceeded for DynamoDB or Lagging/delayed for consuming Kinesis records when using multiple at a time

TL;DR I probably know that it is not a good approach, but I was wondering if it is too bad to have one application with multiple KCL configured

I'm also using KCL along with WebFlux which I never saw anyone combining these two

gabrielfmagalhaes commented 3 months ago

To add more context, I know that this will eventually require more CPU and Memory for my application, but compared to SQS Queues that I can consume from multiple queues and expect minimal side effects, does the same apply to KCL?

brendan-p-lynch commented 3 months ago

I assume what you mean is that you have multiple instances of the KCL spun up on the same instance, and this application is calling the KCL in parallel. There is not necessarily a problem with this, as we try to allow you to do it in parallel, and having multiple different workers owning the shard. Generally there are better ways to do this including spinning up multiple instances or letting a single instance own more leases that would increase parallelization without spinning up more instances that will cost more computer resources.