简体   繁体   中英

Batch size - Lambda / Kinesis

I have a lambda which is triggered by a Kinesis stream. Considering I've set the batch size to 5, will the stream trigger the lambda upon sending 5 messages? Or will it trigger 5 different lambdas' threads?

The batch size represents the maximum batch size. Your Lambda will never be called with more than 5 objects at a time. However, it will not wait until 5 objects show up before calling your Lambda function so your Lambda function could definitely be called with fewer than 5 objects.

I'm not exactly sure what you mean by threads. Lambda may spin up additional containers to handle large volumes of events from your Kinesis dream but that is not directly related to your batch size.

The previous answer is correct regarding the batch size. Your function will never be called with more than 5 records. However, it may be called with less. This really depends on the throughput of your stream.

Regarding your question of how many lambda functions will be invoked. There will be one lambda function running per shard in your stream. So if you have a stream with one shard, there will only be one lambda function running in parallel. If you have a stream with 10 shards, there will be up to 10 lambda functions running in parallel (it might be less if your throughput is too low and not all shards process data).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM