dubbo:protocol

dubbo:protocol element

Service provider protocol configuration. The corresponding class is org.apache.dubbo.config.ProtocolConfig. If you need to support multiple protocols, you could declare multiple <dubbo:protocol> tags, and specify the protocol via protocol property.

AttributeCorresponding URL parameterTypeRequiredDefault ValueFunctionDescriptionCompatibility
idstringFalsedubboConfiguration associationBean Id of the protocol, can be referenced in <dubbo:service protocol=""> The default value is equal to the value of name attribute while id is not filled. If name value has already existed, it will add index to it’s suffix.Above 2.0.5
name<protocol>stringTruedubboPerformance optimizeProtocol nameAbove 2.0.5
port<port>intFalseThe default port of dubbo protocol is 20880, rmi protocol is 1099, http and hessian protocol are 80;It will allocate the default port if port is not filled; It will allocate an unused port if port equals -1. To ensure the ports scope is controllable, the port will increase based on the corresponding protocol default port after Dubbo 2.4.0+Service discoveryService portAbove 2.0.5
host<host>stringFalseFind local IP automaticallyService discovery-The host name of services, to specify VIP and domain, or having multiple network cards. If null, it will find local IP automatically- It’s recommended to let Dubbo find local IP automaticallyAbove 2.0.5
threadpoolthreadpoolstringFalsefixedPerformance optimizeThe type of Thread Pool, fixed/cached are availableAbove 2.0.5
threadsthreadsintFalse200Performance optimizeThe size of the services' Thread Pool(Fixed)Above 2.0.5
iothreadsthreadsintFalseThe count of CPU + 1Performance optimizeThe size of io Thread Pool(Fixed)Above 2.0.5
acceptsacceptsintFalse0Performance optimizeThe maximum connection count of the service providerAbove 2.0.5
payloadpayloadintFalse8388608(=8M)Performance optimizeThe length limit of request and response, unit is byteAbove 2.0.5
codeccodecstringFalsedubboPerformance optimizeProtocol encodingAbove 2.0.5
serializationserializationstringFalseThe default serialization of dubbo protocol is hessian2, rmi protocol is java, http protocol is jsonPerformance optimizeProtocol serialization, It’s used when a protocol has multiple serializations. For example, dubbo protocol has 4 serializations, they are dubbo, hessian2, java and compactedjava.Above 2.0.5
accesslogaccesslogstring/booleanFalseService discoverytrue will write access log to logger. Specifying it to a log path, you can write access logs to special log file.Above 2.0.5
path<path>stringFalseService discoveryContext path, the prefix of the service pathAbove 2.0.5
transportertransporterstringFalseThe default value of dubbo protocol is nettyPerformance optimizeThe server and client implements of the protocol. For example, mina and netty for dubbo protocol. You can configure server or client side separately.Above 2.0.5
serverserverstringFalseThe default value of dubbo protocol is netty, http protocol is servletPerformance optimizeThe server implement of the protocol. For example, mina and netty for dubbo ptotocol, jetty and servlet for http protocol.Above 2.0.5
clientclientstringFalseThe default value of dubbo protocol is nettyPerformance optimizeThe client implement of the protocol. For example, mina and netty for dubbo protocol.Above 2.0.5
dispatcherdispatcherstringFalseThe default value of dubbo protocol is allPerformance optimizespecify the thread model of the way to dispatching. Such as all, direct, message, execution, and connection for dubbo protocol.Above 2.1.0
queuesqueuesintFalse0Performance optimizeThe queue size of the Thread Pool. It’s recommended not to specify it in order to invoke other provides rather than queueing unless you have special requirement.Above 2.0.5
charsetcharsetstringFalseUTF-8Performance optimizeSerialization encodingAbove 2.0.5
bufferbufferintFalse8192Performance optimizeThe buffer size of networking IOAbove 2.0.5
heartbeatheartbeatintFalse0Performance optimizeHeartbeat interval. For long connection, it’s difficult to receive closing event while the physical layer is disconnected. So heartbeat is necessary to help checking the connection qualityAbove 2.0.10
telnettelnetstringFalseService discoverySupported telnet commands, use , to separate commands.Above 2.0.5
registerregisterbooleanFalsetrueService discoveryWhether registering the corresponding services to registry centerAbove 2.0.8
contextpathcontextpathStringFalseDefault value is an empty stringService discoveryAbove 2.0.6

Last modified November 25, 2020: fix sample code issue for SPI.md (#659) (0576d68)