Abstract
Priority queues are fundamental to many high-performance computing (HPC) applications, yet traditional binary heap implementations often become a bottleneck due to their $O(\log n)$ complexity. This paper introduces the Multiresolution Priority Queue (MR-PQ), a novel data structure that optimizes performance by discretizing priority space into "resolution groups." By trading off a controllable amount of priority precision, MR-PQ achieves $O(1)$ amortized insertion time in high-load scenarios. Our evaluation within the Bro network security monitor shows that MR-PQ effectively eliminates major CPU bottlenecks, significantly enhancing system throughput in 10Gbps environments.
Introduction
Priority queues underpin critical algorithms in network routing, event-driven simulation, and shortest-path calculations. Traditionally, these are implemented as binary heaps, which maintain a strict total ordering of elements. However, in modern HPC environments—such as network sensors processing traffic at 10Gbps—the number of elements ($n$) can be massive. The resulting logarithmic overhead for insertion and extraction becomes a significant system bottleneck.
The authors observe that many applications do not require infinite priority resolution. For instance, a network timer might only need accuracy to the nearest second. Standard heaps provide "too much" precision at the expense of speed. MR-PQ addresses this mismatch by providing a "good enough" priority ordering that is significantly faster to maintain.
Methods
The core innovation of the Multiresolution Priority Queue (MR-PQ) is the discretization of the priority space into fixed-size "slots" or "resolution groups" ($p_\Delta$).
Data Structure and Partial Ordering
MR-PQ utilizes a doubly linked list to store elements, while a lookup table (array) provides direct pointers to specific resolution slots. Elements within the same resolution group are treated as having the same priority. This relaxes the requirement from a total ordering to a partial ordering, which is computationally cheaper to maintain.
Variants and Optimizations
- BT-MR-PQ: For scenarios with sparse or very large priority ranges, a variant uses a binary search tree for the lookup table. This ensures a worst-case insertion time of $O(\log r)$, where $r$ is the number of resolution groups—typically much smaller than the total number of elements $n$.
- Sliding Priorities: In simulators where time only moves forward, the lookup table can "slide," allowing for efficient memory reuse for future events.
Key Insights and Ideas
The "Resolution Gap" is the fundamental realization that application logic often already involves discretization. Using a data structure that supports nanosecond precision for a 1-second timer is wasted effort.
Furthermore, MR-PQ is highly cache-friendly. Unlike standard heaps that require frequent "pointer chasing" and swaps across a large memory tree (leading to cache thrashing), MR-PQ uses linked lists and localized lookups. Interestingly, MR-PQ performs better as the queue fills up; when most resolution slots are occupied, finding the correct insertion point becomes a consistent $O(1)$ operation.
Evaluation and Results
The researchers integrated MR-PQ into the timer management system of Bro (now Zeek), a prominent network security monitor. The evaluation used real corporate network traces and synthetic 10Gbps traffic (92.34% TCP, 7.5% UDP).
The results were significant:
- Bottleneck Elimination: In the original Bro implementation, the heap’s
BubbleDownfunction consumed 6.5% of the total CPU. MR-PQ effectively eliminated this overhead. - Hardware Efficiency: The new structure reduced the cache miss ratio and improved Instructions Per Cycle (IPC), meaning the CPU spent less time idling for RAM data.
- Increased Throughput: At 10 Gbps, the MR-PQ-enhanced version reduced packet drops and successfully processed a higher volume of network events and files.
Conclusion
MR-PQ offers a compelling alternative to traditional priority queues for applications where a small, controllable loss in precision is acceptable. While it requires pre-defining the priority range and resolution, the performance gains in high-load HPC environments are substantial. Future work may extend this approach to other fundamental algorithms, such as Dijkstra’s shortest path, to further optimize routing and navigation systems.
Summary updated