官术网_书友最值得收藏!

Bounded drop queue

Alternatively, to avoid a memory overflow, we may employ a queue that may ignore incoming messages if it is full. The following marble diagram depicts a queue that has a size of 2 elements and is characterized by dropping elements on overflow (Diagram 3.5):

Diagram 3.5. Example of Drop Queue with a capacity of two items

In general, this technique respects the resources' limitations and makes it possible to configure the capacity of the queue based on the resources' capacities. In turn, embracing this kind of queue is a common practice when the importance of the message is low. An example of a business case may be a stream of dataset-changed events. In turn, each event triggers some statistical recalculation which uses the entire dataset aggregation and takes a significant amount of time in comparison with the incoming events quantity. In that case, the only important thing is the fact that the data set changed; it is not vital to known which data has been affected.

Th e preceding mentioned example considers the simplest strategy for dropping the newest element. In general, there are a few strategies for choosing the element to drop. For example, dropping by priority, dropping the oldest, and so on.
主站蜘蛛池模板: 漠河县| 义乌市| 南木林县| 都匀市| 华安县| 奇台县| 高平市| 闸北区| 鹤壁市| 鹤壁市| 调兵山市| 阳信县| 南岸区| 阿图什市| 大庆市| 锦州市| 大庆市| 尚义县| 五寨县| 家居| 北京市| 平山县| 榆中县| 兰坪| 洛隆县| 前郭尔| 水城县| 枣庄市| 呼伦贝尔市| 鸡东县| 澎湖县| 日土县| 巢湖市| 民丰县| 长岛县| 施甸县| 永安市| 平果县| 墨江| 玉山县| 奉化市|