Basic model

Update time: 0001-01-01


All messages are internally passed through SofaRequest and SofaResponse.

To convert to other protocols, you need to transform the messages to the objects that are to be actually transferred when calling and receiving requests.

The modules that can write SofaRequest and SofaResponse are as follows:

  • Invoker
  • Filter
  • ServerHandler
  • Serialization

The modules that can only read message bodies are as follows:

  • Cluster
  • Router
  • LoadBalance


The log initialization is based on the extension mechanism. Since the log loading should be done earliest, there is a separate key in rpc-config.json.

  / / Log implementation is done earlier than configuration loading, so it cannot adapt to the extension mechanism
  "logger.impl": ""

Configuration items

RPC configuration for users

The user configuration includes port configuration (although the fields for setting port in the objects have been opened, SOFA gets those fields from the configuration file by default), thread pool size configuration, and other configurations.

  • Load the configuration via SofaConfigs and call ExternalConfigLoader to read external properties.
  • Get the configuration through the API provided by SofaConfigs.
  • All the internally configured keys are in the SofaOptions class.
  • Priority: > (one for each application) >

RPC framework configuration

The configuration of the framework itself, such as default serialization and default timeout. In the future, SOFARPC may support the configuration for multiple ClassLoaders.

  • Load the configuration file via RpcConfigs.
  • Get and listen to data changes via the API provided by RpcConfigs
  • All internally configured keys are in the RpcOptions class
  • Priority: > custom rpc-config.json (There may be multiple custom configuration files which are sorted in certain order) > rpc-config-default.json.


  • The global basic constants are in RpcConstants. For example:  

    • Calling method (sync/oneway)
    • Protocol (bolt/grpc/rest); serialization (hessian/java/protobuf)
    • Context key
  • If the extension implements its own constants, you need to maintain the constants yourself. For example:

    • The constants of BOLT protocol
      • PROTOCOL_TR = 13
    • The constants related with DSR Configuration Center
      • The keys specific for DSR Configuration Center, such as _WEIGHT and _CONNECTTIMEOUT


  • The address information of provider is placed in the ProviderInfo class.
  • The value of ProviderInfo is mainly divided into three parts:
    • Fields, which are generally required items, such as IP, port and status.
    • Static fields, such as application name.
    • Dynamic fields, such as warm-up weight.
  • Field enumerations are maintained in the ProviderInfoAttrs class.