arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2401.11347cs.DC
收藏

你的 Epoch 过于宏大了吗?无批处理可能有害

Are Your Epochs Too Epic? Batch Free Can Be Harmful

Daewoo Kim, Trevor Brown, Ajay Singh

AI总结:

本文揭示 EBR 等批量内存回收与现代分配器交互导致的性能损耗,提出随时间摊销大批量释放的简单修复,并在十种算法及 192 线程系统上验证显著加速。

摘要:

基于 Epoch 的内存回收(EBR)因其易用性和在实践中的良好性能,是无锁和乐观锁数据结构中最流行的内存回收技术之一。然而,众所周知 EBR 对线程延迟很敏感,这可能导致性能下降。此外,这种性能下降的确切机制尚未得到充分理解。本文在一个流行的数据结构基准测试中展示了这种性能下降,并进行深入分析以揭示其根本原因——EBR 与最先进内存分配器之间的一种微妙交互。本质上,现代分配器试图通过维护有界的线程对象缓存以供本地复用来降低释放开销,只有在线程缓存变得过大时才真正释放它们(这是一种延迟非常高的操作)。每当特别大的一批对象被释放时,EBR 会立即绕过这些机制,从而大幅增加开销和延迟。除 EBR 之外,许多以大批方式回收对象的内存回收算法和数据结构,也会与流行分配器发生类似的有害交互。我们为此类算法提出了一种简单的算法修复方案,将大批对象的释放随时间摊销,并将该技术应用于十种现有内存回收算法;在高性能无锁 ABtree 上的实验中,观察到十种中有九种性能提升,其中六种提升超过 50%。我们还提出了一种极其简单的 EBR 令牌传递变体,并表明在采用我们的修复后,在一台 192 线程、四路 Intel 系统上,它比已知最快的内存回收算法快 1.5–2.6 倍,并且比完全不回收还快 1.2–1.5 倍。

英文摘要:

Epoch based memory reclamation (EBR) is one of the most popular techniques for reclaiming memory in lock-free and optimistic locking data structures, due to its ease of use and good performance in practice. However, EBR is known to be sensitive to thread delays, which can result in performance degradation. Moreover, the exact mechanism for this performance degradation is not well understood. This paper illustrates this performance degradation in a popular data structure benchmark, and does a deep dive to uncover its root cause-a subtle interaction between EBR and state of the art memory allocators. In essence, modern allocators attempt to reduce the overhead of freeing by maintaining bounded thread caches of objects for local reuse, actually freeing them (a very high latency operation) only when thread caches become too large. EBR immediately bypasses these mechanisms whenever a particularly large batch of objects is freed, substantially increasing overheads and latencies. Beyond EBR, many memory reclamation algorithms, and data structures, that reclaim objects in large batches suffer similar deleterious interactions with popular allocators. We propose a simple algorithmic fix for such algorithms to amortize the freeing of large object batches over time, and apply this technique to ten existing memory reclamation algorithms, observing performance improvements for nine out of ten, and over 50% improvement for six out of ten in experiments on a high performance lock-free ABtree. We also present an extremely simple token passing variant of EBR and show that, with our fix, it performs 1.5-2.6x faster than the fastest known memory reclamation algorithm, and 1.2-1.5x faster than not reclaiming at all, on a 192 thread four socket Intel system.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑