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

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.
主站蜘蛛池模板: 湟源县| 普陀区| 新巴尔虎左旗| 调兵山市| 怀来县| 台州市| 安仁县| 乾安县| 同德县| 鄂托克旗| 辽宁省| 渭南市| 舒城县| 博野县| 铜鼓县| 特克斯县| 巩留县| 进贤县| 灵寿县| 江山市| 汝州市| 嵊州市| 祁东县| 美姑县| 青冈县| 竹北市| 青浦区| 丰城市| 进贤县| 五河县| 拜城县| 乐业县| 武乡县| 宣威市| 峨山| 达日县| 凉山| 田阳县| 岳普湖县| 邓州市| 安仁县|