Block Size and Queue Size
A local event queue is basically a large ring buffer consisting of one or more dynamically allocated blocks. Posted events are appended to the buffer (serialized as CBOR), whilst the consumer reads events from the front of the buffer.
The maximum size of the ring buffer (the queue size) is limited. If serialization of a group of events results in a buffer overflow, all events in the group are silently discarded. The consumer can use IStatsEventQueue.getDiscardedEventCount() to obtain the number of discarded events.
Two application properties can be used to configure block and buffer/queue size:
-
egr.eai.fw.statistics.local_queue.block_size– the block size; Valid values are between 64 and 524256 (slightly less than 512 KB), both inclusive. The default value is 4096. -
egr.eai.fw.statistics.local_queue.size– the queue size; Valid values are between 1024 and 2147483647 (0x7fffffff), both inclusive.
The queue size must be at least as large as the block size, and is rounded up to a multiple of the block size.
The ring buffer consists of at most n + 1 blocks, where n is the queue size divided by the block size. The extra block is necessary to prevent the effective queue size from becoming smaller than the configured queue size (the effective queue size is the total queue size minus the number of bytes already read from the first block).