Skip to main content
QUICK REVIEW

[论文解读] Coz: Finding Code that Counts with Causal Profiling

Charlie Curtsinger, Emery D. Berger|arXiv (Cornell University)|Aug 12, 2016
Software System Performance and Reliability被引用 4
一句话总结

本文提出因果剖析(causal profiling),一种新颖的性能分析技术,可识别出优化后能显著提升应用程序吞吐量或延迟的代码区域。通过在并发执行中对其他代码进行受控减速,虚拟加速特定代码行,\coz\xspace 能准确预测优化影响——在真实系统中仅通过少量代码修改,即实现 9% 至 68% 的性能提升。

ABSTRACT

Improving performance is a central concern for software developers. To locate optimization opportunities, developers rely on software profilers. However, these profilers only report where programs spent their time: optimizing that code may have no impact on performance. Past profilers thus both waste developer time and make it difficult for them to uncover significant optimization opportunities. This paper introduces causal profiling. Unlike past profiling approaches, causal profiling indicates exactly where programmers should focus their optimization efforts, and quantifies their potential impact. Causal profiling works by running performance experiments during program execution. Each experiment calculates the impact of any potential optimization by virtually speeding up code: inserting pauses that slow down all other code running concurrently. The key insight is that this slowdown has the same relative effect as running that line faster, thus "virtually" speeding it up. We present Coz, a causal profiler, which we evaluate on a range of highly-tuned applications: Memcached, SQLite, and the PARSEC benchmark suite. Coz identifies previously unknown optimization opportunities that are both significant and targeted. Guided by Coz, we improve the performance of Memcached by 9%, SQLite by 25%, and accelerate six PARSEC applications by as much as 68%; in most cases, these optimizations involve modifying under 10 lines of code.

研究动机与目标

  • 解决传统剖析器仅报告时间消耗而无法反映优化该代码实际性能影响的局限性。
  • 引导开发人员关注真正影响吞吐量或延迟的优化机会,而非仅关注耗时代码。
  • 提供一种精确、基于实验的方法,量化假设性代码优化的性能影响。
  • 在高度优化的并发应用程序中,实现高效且准确的优化机会识别。
  • 克服现有工具仅关注显式线程通信或可扩展性指标所导致的不足。

提出的方法

  • 因果剖析使用虚拟加速,通过在所有其他并发运行代码中插入人工延迟,来模拟优化特定代码行的效果。
  • 每次性能实验测量当某一行被虚拟加速特定百分比时,程序吞吐量或延迟的改善程度。
  • 该方法依赖于一个关键洞察:在某行执行期间减慢所有其他代码,其相对效果等同于使该行变快。
  • 剖析器对所有关注的代码行进行一系列此类实验,构建优化影响的因果模型。
  • 结果以图表形式呈现,显示在不同虚拟加速水平下,每行代码的预期加速效果。
  • 该方法已实现在 \coz 中,一个原型因果剖析器,可与标准性能监控工具集成,并在真实应用程序上高效运行。

实验结果

研究问题

  • RQ1是否存在一种剖析技术,能够准确预测优化特定代码行的性能影响,而不仅限于测量执行时间?
  • RQ2通过受控减速并发代码实现的虚拟加速,是否能提供一种可靠且高效的优化收益估算方法?
  • RQ3因果剖析能否在真实世界中高度优化的系统中,识别出此前未知的、高影响力优化机会?
  • RQ4因果剖析在多大程度上能指导开发人员以最少的代码修改实现显著的性能提升?
  • RQ5与传统剖析器及其他性能分析工具相比,因果剖析在识别有意义优化目标方面表现如何?

主要发现

  • 因果剖析正确识别出在示例程序中优化函数 $f_a$ 最多仅能带来 4.5% 的性能提升,而优化 $f_b$ 则无影响,尽管两者执行时间相近。
  • \coz 剖析器对这些影响的预测值与实际值相差不超过 0.5%,展现出对优化效果估计的高精度。
  • 在 \coz 的引导下,作者在 Memcached 中实现了 9% 的性能提升,在 SQLite 中实现了 25% 的提升,在六个 PARSEC 应用中最高实现了 68% 的加速。
  • 在大多数情况下,性能提升仅通过修改少于 10 行代码即实现,表明优化效率极高。
  • 该方法成功识别出由缓存一致性、调度依赖和 I/O 引起的性能瓶颈,而不仅限于显式线程同步。
  • 与传统剖析器不同,\coz 避免误导开发人员,能清晰区分耗时代码与真正能改善端到端性能指标(如吞吐量和延迟)的代码。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。