JimChengLin commented on PR #2398: URL: https://github.com/apache/brpc/pull/2398#issuecomment-1762508827
我理解这个 MR 主要是两方面的工作: 1. 给 ParkingLot 加了一个 waiter counter,如果没有 waiter 就不要走 futex wake 了,可以省 syscall。这是一个没有副作用的优化。还有个小建议是没有 waiter 的情况就不要计入 no singal 了,这时候所有 worker 已经火力全开了,攒着也没啥用。 2. 用 global queue 来替换 tg 的 remote task q。这个我考虑过一段时间了。我的 concern 在于这是 trade off 而不是纯优化。bthread 当前 steal 是随机 probe 所有的 tg。坏处是 tg 的 task 少的话,steal 会扫来扫去的。好处是 task 多的话,cache line 竞争会小。当然 global queue 也可以内部自己分多条 queue,但 trade off 是一样的。 就是这个steal策略有 2 个维度,一个是负载,一个是吞吐导向还是响应导向。如果负载低就应该用全局数据结构,反之要 shard。如果吞吐导向就应该 batch 唤醒和派发,反之应该激进唤醒 waiter。我不觉得有啥办法能把这 4 点就满足了。 华为最近 OSDI 2023 有篇 https://www.usenix.org/conference/osdi23/presentation/wang-jiawei NSDI 2022 也有 https://www.[usenix.org/system/files/nsdi22-paper-mcclure_2.pdf](https://www.usenix.org/system/files/nsdi22-paper-mcclure_2.pdf) tldr,我觉得线上作为默认调度都差点意思。BWoS 给 tokio 的 PR 好久还没合进去。 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For additional commands, e-mail: dev-h...@brpc.apache.org