sofastack / sofa-rpc

SOFARPC is a high-performance, high-extensibility, production-level Java RPC framework.
https://www.sofastack.tech/sofa-rpc/docs/Home
Apache License 2.0
3.81k stars 1.16k forks source link

enhance: reuse thread pool for scheduled service #1389

Closed Lo1nt closed 5 months ago

Lo1nt commented 5 months ago

Motivation:

It might be exhausted when create new executor pool for some scheduled cases such as reconnection, where each consumer may has its own scheduled executor pool and its own thread. Amount of threads may grow to O(m) aligns with amount of consumers.

Modification:

add a reused schedule pool that may provide same pool with same unique key

Result:

codecov[bot] commented 5 months ago

Codecov Report

Attention: 39 lines in your changes are missing coverage. Please review.

Comparison is base (9faa8b8) 72.04% compared to head (8ffa761) 72.03%. Report is 4 commits behind head on master.

Files Patch % Lines
...va/com/alipay/sofa/rpc/server/bolt/BoltServer.java 53.06% 16 Missing and 7 partials :warning:
.../sofa/rpc/dynamic/DynamicConfigManagerFactory.java 0.00% 6 Missing :warning:
...ava/com/alipay/sofa/rpc/server/UserThreadPool.java 75.00% 2 Missing and 2 partials :warning:
...ay/sofa/rpc/client/AllConnectConnectionHolder.java 75.00% 1 Missing :warning:
...sofa/rpc/common/threadpool/ThreadPoolConstant.java 0.00% 1 Missing :warning:
...threadpool/extension/VirtualThreadPoolFactory.java 50.00% 1 Missing :warning:
.../alipay/sofa/rpc/server/UserVirtualThreadPool.java 83.33% 1 Missing :warning:
...a/com/alipay/sofa/rpc/event/LookoutSubscriber.java 66.66% 0 Missing and 1 partial :warning:
...ipay/sofa/rpc/server/bolt/BoltServerProcessor.java 50.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1389 +/- ## ============================================ - Coverage 72.04% 72.03% -0.02% - Complexity 785 792 +7 ============================================ Files 417 423 +6 Lines 17709 17807 +98 Branches 2760 2768 +8 ============================================ + Hits 12759 12827 +68 - Misses 3546 3567 +21 - Partials 1404 1413 +9 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.