awslabs / amazon-kinesis-client

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

Documentation on _CHECKPOINT_FREQ_SECONDS #1322

Open duncanwraight opened 2 months ago

duncanwraight commented 2 months ago

Hi folks

I've been looking around online and I can't find any proper documentation on how the KCL works with regard to checkpoints and how often they occur.

I'm using the Python client. The example code in your Github repository has this variable set:

        self._CHECKPOINT_FREQ_SECONDS: int = 10

The example code then appears to process_records at (at least) this interval, so it will only ever "do something" once every 10 seconds (minimum; sometimes longer).

            #
            # Checkpoints every self._CHECKPOINT_FREQ_SECONDS seconds
            #
            if time.time() - self._last_checkpoint_time > self._CHECKPOINT_FREQ_SECONDS:

What I'm trying to understand is.. why? What's the purpose of this "delay"? Could this value be 0? Or perhaps 0.1?

I suspect I'm misunderstanding the way Kinesis/KCL works here, but without any documentation that I can find, I'm at a loss.

Cheers