The configuration details are as follows.
||BOOLEAN||The switch for local call preference.||false|
||STRING||The RPC running mode.||null|
||INTEGER||The TR port number.||12200|
||STRING||The fixed network interface bound to the server.||null|
||STRING||The range of local IP addresses bound to the server.||null|
||INTEGER||The minimum number of threads in the thread pool of the TR server.||20|
||INTEGER||The maximum number of threads in the thread pool of the TR server.||200|
||INTEGER||The queue size of the thread pool of the TR server.||0|
||INTEGER||* The Bolt port number.||12200|
||INTEGER||* The minimum number of threads in the thread pool of the Bolt server.||20|
||INTEGER||* The maximum number of threads in the thread pool of the Bolt server.||200|
||INTEGER||* The queue size of the thread pool of the BOLT server.||0|
||INTEGER||The SOFAREST port number.||8341|
||STRING||The preloading and weight configuration.||null|
||INTEGER||The timeout period of preloading, in ms.||0|
||INTEGER||The print threshold of RPC service performance logs, in ms.||300|
When multiple apps are started locally, to make them call each other first without SLB, you just need to add
sofa_runtime_local_mode still depends on the IP addresses pushed by the configuration center. After obtaining the IP address list of service providers, the consumer prefer local IP addresses for service calling. If the workspace where the developer is located does not provide a configuration center, the service provider IP address needs to be specified for calling. For more information, see Routing and configuration center.
<! -- Service consumer configuration -->
<global-attrs test-url="localhost:12200" />
When publishing a service IP address, SOFARPC publishes the IP address of the first local network interface to the configuration center. If several network interfaces (for example, the SOFAStack platform includes LAN IP addresses and Internet IP addresses) are available, you need to set an IP address selection strategy.
SOFARPC provides two methods to select an IP address:
Choose an IP address by specifying the network interface name:
Specify the IP address range for binding. Format:
IP_RANGE1:IP_RANGE2,IP_RANGE. For example,
rpc_enabled_ip_range=10.1:10.2,11means the IP address can only be selected from
10.1.0.0 ~ 10.2.255.255and
126.96.36.199 ~ 188.8.131.52.
Note: The LAN IP addresses on the SOFAStack platform are all bound to network interface eth0. We recommend that you use
rpc_bind_network_interface=eth0directly. If you run an app on a platform other than SOFAStack, check the LAN IP addresses of the server to decide what configuration you should use. The command for viewing the IP address of the server:
ipconfigfor Windows systems, and
ifconfigfor Mac/Linux systems.
application.properties file, use the following options to configure the TR thread pool:
com.alipay.sofa.rpc.bolt.thread.pool.core.size: the minimum number of threads, which is 20 by default
com.alipay.sofa.rpc.bolt.thread.pool.max.size: the maximum number of threads, which is 200 by default
com.alipay.sofa.rpc.bolt.thread.pool.queue.size: the queue size, which is 0 by default
TR adopts the thread pool
ThreadPoolExecutor of JDK. If being extended, the core thread pool first expands to the size with the minimum number of threads. When concurrent requests surpass the minimum number of threads, the excessive requests wait in a queue. When the queue is full, the thread pool expands to the size with the maximum number of threads. When the requests exceed the maximum number of threads, the
RejectionException exception is thrown.
For more information, see Log description.