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

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.
主站蜘蛛池模板: 长汀县| 连城县| 常山县| 平邑县| 手游| 寿光市| 剑川县| 萝北县| 瑞丽市| 武乡县| 永川市| 灵丘县| 信阳市| 红安县| 新营市| 平湖市| 沁阳市| 肇州县| 正镶白旗| 应用必备| 左权县| 古田县| 兴宁市| 安乡县| 黄石市| 汨罗市| 盐边县| 壤塘县| 门头沟区| 七台河市| 原平市| 新源县| 榆林市| 高州市| 长宁区| 丁青县| 阳新县| 囊谦县| 凤冈县| 肇东市| 朝阳区|