I would like to confirm which is the best way of committing offsets manually from the perspectives of Performance.
NA
Please provide the following information:
if you consume 10 messages, you only need to commit once corresponding to the final message, not each one, and this will be 10x as efficient as committing after every message.
side note: the best way to achieve at least once semantics is to set AutoOffsetStore to false and AutoOffsetCommit to true, and use StoreOffsets to mark offsets as eligible to commit. A background thread will periodically commit them at interval AutoCommitIntervalMs.
Most helpful comment
if you consume 10 messages, you only need to commit once corresponding to the final message, not each one, and this will be 10x as efficient as committing after every message.
side note: the best way to achieve at least once semantics is to set
AutoOffsetStoretofalseandAutoOffsetCommittotrue, and useStoreOffsetsto mark offsets as eligible to commit. A background thread will periodically commit them at intervalAutoCommitIntervalMs.