其他分享
首页 > 其他分享> > Performance Scaling Laws

Performance Scaling Laws

作者:互联网

   

并行优化有两个 scaling laws指导优化的界。

Amdahl's Law

Amdahl's Law又叫strong scaling law。

Amdahl's Law
For a given workload in single node, the theoretical speedup of the latency of the workload, is constricted both by the number of processors executing and the serial proportion of the workload.
Alt text
阿姆达尔定律解决的问题是:给定workload,优化其性能,关注于把给定的任务做好。
假设给定workload的初始latency为,其中可并行优化部分latency为, 非可并行优化部分latency为
那么,使用n路并行只能优化其并行部分,优化后可并行部分最好latency为,非可并行优化部分latency仍为,总latency为
因此,性能提升上限为, 即为

Amdahl's Law是面向工程师的,提醒工程师谨防无用功,在性能优化时,除了看模块性能增益外,更要关注模块对整个workload的增益。在优化前一定要做好收益分析,而收益分析的前提是性能分布。
举个例子:一个可并行优化部分latency占总workload latency比为50%的workload。不管可并行部分怎么优化,它对这个workload的贡献上限为2x;且在模块性能已到8x优化后,对改部分的优化的投入的收益会很marginal,可以考虑多分析分析其他部分。

Alt text
Amdahl's Law告诉我们对给定workload的优化是有明显饱和区的,因此要格外关注性价比指标。如何关注性价比指标,就是要做好测量,无测量不优化。对程序员来说就是执行好profiling based optimization。

Alt text

Gustafson's Law

Gustafson's Law又叫weak scaling law。

Gustafson's Law
For a scaled-up/scaled-out workload in

标签:latency,workload,并行,Scaling,Amdahl,Performance,Law,优化,Laws
来源: https://www.cnblogs.com/Matrix_Yao/p/15863864.html