apache / dubbo

The java implementation of Apache Dubbo. An RPC and microservice framework.
https://dubbo.apache.org/
Apache License 2.0
40.51k stars 26.43k forks source link

protocol线程池参数配置无效 #14531

Closed jiang017 closed 2 months ago

jiang017 commented 3 months ago

Pre-check

Search before asking

Apache Dubbo Component

Java SDK (apache/dubbo)

Dubbo Version

Dubbo version: 3.1.8 Operating System version:Windows 10 Java version: 1.8 Spring Boot: 2.1.18

Steps to reproduce this issue

如下图所示: 当添加如下线程池配置时,均未生效,线程池依旧是CachedThreadPool。

dubbo.protocol.threadpool: fixed dubbo.protocol.threads: 102 dubbo.protocol.corethreads: 11 image

跟踪参数链路发现,在ConfigurableMetadataServiceExporter#buildServiceConfig进行了默认参数设置,最终导致配置失效。

为了使得上述配置生效,项目当前路径导入ConfigurableMetadataServiceExporter并重写buildServiceConfig方法。

对以下代码进行注释,线程池参数 及 类型,均正确,达到预期。

位置:ConfigurableMetadataServiceExporter#buildServiceConfig

threadParams.put(THREADPOOL_KEY, "cached");
threadParams.put(THREADS_KEY, "100");
threadParams.put(CORE_THREADS_KEY, "2");

image

What you expected to happen

希望通过其它方式让线程池配置dubbo.protocol.threadpool 及 dubbo.protocol.threads 生效,而非以上代码重写(注释)的方式。

Anything else

No response

Are you willing to submit a pull request to fix on your own?

Code of Conduct

heliang666s commented 3 months ago

Hello, welcome to the dubbo community, please describe your problem in English

funky-eyes commented 3 months ago

Did you create a ProtocolConfig bean yourself, or are you not using dubbo-spring-boot-starter at all?

jiang017 commented 2 months ago

Did you create a ProtocolConfig bean yourself, or are you not using dubbo-spring-boot-starter at all?

I used dubbo spring boot starter with version 3.1.8 and have not made any custom beans for ProtocolConfig

jiang017 commented 2 months ago

Did you create a ProtocolConfig bean yourself, or are you not using dubbo-spring-boot-starter at all?

I used dubbo spring boot starter with version 3.1.8 and have not made any custom beans for ProtocolConfig

I feel it's strange. As long as I delete the configuration of ConfigurableMetadataServiceExporter#buildServiceConfig-threadParams, everything will become normal and parameter dubbo.protocol.threads will take effect

laywin commented 2 months ago

In version 3.1.8, metadata export uses the internal cached thread pool configuration. Application-level service export uses your own thread pool configuration.

AlbumenJ commented 2 months ago
  1. Please try on the latest version (3.2.x)
  2. Please re-submit the issue in English if you still have any question.