Shahin

Flush Interval

Advanced
Updated Jul 11, 2026 Shahin editorial 2 min read
PronunciationEN/flʌʃ ˈɪntərvəl/

The flush interval is the time a library waits between two drains of the event queue; it decides how often collected events are sent to the server.

The flush interval is the decision about the timing of batch sending, and it is a trade-off between data freshness and thrift: a short interval means data appears sooner in reports but with more network requests and higher battery use; a long interval means cheaper sending but more delay and a higher risk of losing events if the user closes the page before a drain. So good libraries do not rely on a fixed interval alone; besides time, they flush when the queue reaches a set size and, more importantly, flush immediately on page close via a beacon mechanism so the last events are not lost. The misconception is that a shorter interval is always better; on a high-traffic site a very short interval can become a flood of requests without the data freshness being worth the cost.