homeassistant-elasticsearch
homeassistant-elasticsearch copied to clipboard
[2.0] Consider limiting max queue size
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.
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:
- Force a publish to purge the queue
- Stop accepting new items
- 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
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%