baidu / babylon

High-Performance C++ Fundamental Library
Apache License 2.0
490 stars 61 forks source link

performence question: babylon::Executor vs folly::CPUThreadPoolExecutor? #10

Closed wanghenshui closed 6 months ago

wanghenshui commented 6 months ago
oathdruid commented 6 months ago

first of all, babylon::Executor is mostly an SPI to unify different thread pool implementations. For example, the babylon::anyflow DAG engine, when using in brpc server will use BthreadExecutor but when using in Apollo will use CyberExecutor.

When it comes to babylon::ConcurrentBoundedQueue vs folly::UnboundedQueue, I prefer use Bounded one for thread pool. But in production environment, we always need to set a concurrent limit to prevent non-recoverable overload. This makes auto grow rarely useful.

For the futex api, the new bitset style can compact set of futex into one int, but seems no performance difference there.

folly one is a more feature-rich and production-ready thread pool, so if some one need a standard thread pool, that is a good choice. But i usually prefer some use-level coroutine over the standard thread pool, if that is possible.

wanghenshui commented 6 months ago

thank you for your explation

wanghenshui commented 6 months ago

first of all, babylon::Executor is mostly an SPI to unify different thread pool implementations. For example, the babylon::anyflow DAG engine, when using in brpc server will use BthreadExecutor

I could not found the BthreadExecutor source code, could open source it soon or later?

oathdruid commented 6 months ago

inside baidu, we have a repo take depends on both babylon and brpc and tools like BThreadExecutor and some RPC enhancement all placed there.

after babylon is open sourced, maybe i could place them in brpc open source repo and make brpc take dependency on babylon. But need some time to find a right way to do that

wanghenshui commented 6 months ago

inside baidu, we have a repo take depends on both babylon and brpc and tools like BThreadExecutor and some RPC enhancement all placed there.

after babylon is open sourced, maybe i could place them in brpc open source repo and make brpc take dependency on babylon. But need some time to find a right way to do that

thank you! i have a brpc store service, really need that executor to make fully async