Kinesis Firehose putRecord vs putRecordBatch

2.4k views Asked by At

I'm using the Java API for Kinesis Firehose and am leveraging putRecordBatch() where possible. However, in my application, I occasionally only send one record and cannot afford to wait for more or cache it in memory.

However, my code's a bit more complicated than I want it to be because I'm tracking success/failure counts for each operation. putRecordBatch returns an int representing the number of failed submits out the set of records sent e.g. 2 out 4 failures whereas putRecord() either succeeds or throws an exception.

I'd prefer to just use putRecordBatch() everywhere but the doc says to only use it if you have multiple records to submit.

This might be a bit of a long shot, but does anyone here have experience with this API, specifically these methods? Have you done what I'm contemplating and just used putRecordBatch() everywhere, even with a record set of 1?

1

There are 1 answers

2
dizzyf On

I've set up exactly what you're describing: a situation that normally sends batched calls but occasionally will only send one record using putRecordBatch(). From my understanding of the docs, it appears that they're only clarifying that if you want to just send one record, you should be using putRecord, as opposed to actually mandating that. From the performance benefits I'm seeing using only putRecordBatch() — which works fine if you need to send 1 record, by the way — I'm confident that you should be okay to use putRecordBatch() for all submits.