xiaoshi100086
xiaoshi100086
### Describe what this PR does / why we need it [[BUG] getProcessCpuStat return value (in percentage) breaks compatibility](https://github.com/alibaba/sentinel-golang/issues/435) ### Does this pull request fix one issue? Fixes #435 ###...
背景: - sentinel 基于bbr算法的启发实现了系统自适应保护,原理文档可见:https://sentinelguard.io/zh-cn/docs/system-adaptive-protection.html - bbr算法的核心逻辑是系统存在一个最佳的并发请求量,能够保证处理时延达到最小值,处理带宽达到最大值。通过找到系统的最小延时 `RTprop` 和最大带宽 `BtlBw`,然后通过公式 `BDP = BtlBw * RTprop` 得到时延带宽积,该值就是最佳的并发处理量。原理可见:https://queue.acm.org/detail.cfm?id=3022184 - 系统的最小延时 RTprop 和最大带宽 BtlBw 无法同时得到。bbr算法会交替探测带宽和延迟:周期性的增加发包速率然后还原,统计这段时间的最大带宽;周期性以极低的速率发包然后还原,统计这段时间的最小时延。 疑问: 而看了sentinel 相关的源码,并没有交替探测带宽和延迟的机制,而是每次都是从滑动窗口的统计数据中得到最近一段时间的最小时延和最大带宽,计算时延带宽积来限制并发请求量。这里的做法与bbr不同,我对sentinel的实现有疑问,这种方法计算的时延带宽积可能不是最佳的并发请求量。
I find entry use array for storage in struct segment. This approach requires the implementation of get, set interfaces and expansion logic. ```golang type segment struct { // ... slotLens...
**Describe the bug** process.Percent sometime return wrong value when have mary goroutines. **To Reproduce** I write demo code. ```go package main import ( "fmt" "os" "time" "github.com/shirou/gopsutil/process" ) const MaxPercent...