homeassistant-elasticsearch icon indicating copy to clipboard operation
homeassistant-elasticsearch copied to clipboard

[2.0] Consider limiting max queue size

Open strawgate opened this issue 10 months ago • 2 comments

We store entity states in an internal queue, when we implement the change to enrich before queuing, this data will be even larger.

We should consider measuring the memory usage as the queue size increases and pick a max queue size that 1) is larger than large HA instances (20k+ entities), 2) provides an upper limit of memory usage.

strawgate avatar Jan 12 '25 17:01 strawgate

Yeah, this was one motivation for originally enriching during the publish phase. What do you propose when we hit the max size? The options that immediately come to my mind are:

  1. Force a publish to purge the queue
  2. Stop accepting new items
  3. Make this a FIFO queue, and purge the oldest entry (or oldest entry for the entity with the incoming record) to make room for the next

legrego avatar Jan 13 '25 16:01 legrego

My guess is making it a fifo queue would be the best bet along with invoking a publish when the queue utilization hits a certain size like 50%

strawgate avatar Jan 13 '25 16:01 strawgate