Help Center/ Cloud Service Engine/ Developer Guide/ Using ServiceComb Engine Functions/ Mechanism of Cashing Spring Cloud Huawei Microservice Instances and Configurations
Updated on 2026-03-20 GMT+08:00

Mechanism of Cashing Spring Cloud Huawei Microservice Instances and Configurations

Mechanism of Caching Microservice Instances

The Spring Cloud Huawei microservice instance cache is built and updated in servicecomb-client. The refresh mechanism is as follows:

  1. During the startup phase, microservice instance information is not cached. However, after the microservice is ready, an asynchronous task starts to update the microservice instance information based on key in InstancesCache at a specified interval.
  2. After receiving the request, the system preferentially obtains the cache information of the target microservice instance from InstancesCache. If the cache information does not exist, the system obtains the instance information from the registry center based on the application name and microservice name. After the instance information is obtained, the system uses the application name and microservice name in the parameters to construct a unique key, the instance information is cached to the memory. If the instance information does not exist in the registry center, the instance information is not cached.
  3. When InstancesCache is updated periodically:
    • If the registry center responds normally and the instance information changes, the instance information of the corresponding microservice is updated.
    • If the registry center responds abnormally:
      • The engine does not return an I/O exception. The request ends.
      • The engine returns an I/O exception and the cache instance information of the current microservice is cleared.

        In 1.11.12-2021.0.x/1.11.12-2023.0.x/1.11.12-2024.0.x and later versions, the instance cache information is not cleared when the request is abnormal.

Mechanism of Caching Configurations

Spring Cloud Huawei microservice instance uses the pull method to periodically obtain the current microservice configuration from the configuration center.

During microservice startup, the current full configuration is obtained from different configuration scopes and updated to Spring Environment for application configuration management. After the startup is complete, an asynchronous task starts to periodically interact with the configuration center to obtain configurations. If the configuration center responds normally and the configurations are deleted, added, or updated, the configurations are synchronized to Spring Environment. Then, a new asynchronous task starts to wait for the next configuration obtaining. If the configuration center responds abnormally, the Spring Environment configuration does not need to be updated. Instead, only a new asynchronous task waits for the next configuration obtaining.