Why is the execution frequency of a Simple Log Service trigger higher than expected?
Each shard of a Simple Log Service (SLS) Logstore triggers a function invocation when new data is written to the shard, so the trigger frequency that you see is the total for the entire Logstore. In addition, when a trigger delay occurs, the trigger catches up with the data, which may shorten the trigger interval.
Symptoms
The frequency at which an SLS trigger invokes a function is sometimes higher than expected.
Cause
Each shard is triggered separately. The total number of invocations that you see for a Logstore may be large, but the real-time trigger time of each shard still matches the configured interval.
The trigger interval of a single shard is the same as the time range of the data processed in each invocation. When the function runs, the trigger interval falls into the following two cases. In this example, the trigger interval is 60 seconds.
-
No trigger delay: The function is triggered at the configured interval, once every 60 seconds, and the processed data range is
[now -60s, now).NoteFunctions are triggered independently for each shard. Assume that a Logstore has 10 shards. When data is processed in real time (no trigger delay), 10 function invocations are triggered every 60 seconds.
-
Trigger delay, which occurs when the current processing position of the SLS shard is more than 10 seconds behind the latest written data: The trigger catches up with the data and may fire once every 2 seconds. The data range processed each time is still a 60-second window.