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

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.
主站蜘蛛池模板: 蒙城县| 江油市| 南川市| 灵山县| 建昌县| 资兴市| 桓台县| 海口市| 塔城市| 乐亭县| 天柱县| 壤塘县| 元阳县| 罗定市| 常熟市| 丹寨县| 平和县| 六安市| 景谷| 邵阳县| 乌兰县| 海伦市| 峨眉山市| 彝良县| 海南省| 麻阳| 石台县| 黎川县| 桓台县| 沁源县| 万宁市| 尉犁县| 井陉县| 乌苏市| 弥渡县| 海南省| 舟曲县| 唐山市| 永清县| 枝江市| 宜丰县|