I am migrating from a KinesisProducerLibrary (KPL) to a Kinesis Async Client but the Wrapper class function to this execution is seeing an increase in latency:
Kinesis Async Client:
@Provides
@Singleton
fun kinesisAsyncClient(): KinesisAsyncClient {
return KinesisAsyncClient.builder()
.region(software.amazon.awssdk.regions.Region.of(getAwsRegion()))
.build()
}
Use:
try {
val eventBytes = JSON.writeValueAsBytes(eventRecord)
val request = PutRecordRequest.builder()
.streamName(streamName)
.partitionKey(eventRecord.entityId)
.data(SdkBytes.fromByteArray(eventBytes))
.build()
kinesisAsyncClient.putRecord(request)
} catch (e: Exception) { ...
I know KPL is good for higher load but I have seen services do far better with Kinesis sync and async clients with similar traffic as mine.
Yet while I am stress testing this logic, the wrapper function latency is increasing as I increase traffic. While Kinesis publish to receive latency is improving.
Am I missing something obvious? Should I add an async client with maxConcurrency value to improve latency?