Symptoms

If a large number of services are registered or subscribed to for a High-speed Service Framework (HSF) application that is developed by using Pandora Boot, the startup of the application is slow.

Causes

An HSF application developed by using Pandora Boot specifies a default timeout period used for address synchronization from the config server for each published service (provider) or consumed service (consumer). The default timeout period is 3,000 milliseconds. If a large number of services are published or consumed, each service needs to wait for address synchronization in series. This leads to slow application startup.

Solutions


  • Open the application.properties file of the Pandora Boot-based application and modify the parameter spring.hsf.max-wait-address-time. This parameter is used to set a global default timeout period for address synchronization in milliseconds. For example, you can use the following setting:
    spring.hsf.max-wait-address-time = 500
    Global default timeout period for address synchronization
  • A consumer can also use the addressWaitTime parameter to separately set the timeout period for address synchronization for a service interface.

    During service subscription, a thread is blocked within the timeout period specified by this parameter to wait for an address push. Otherwise, the address may not be found when the service is called. This parameter is required for an interface that needs to subscribe to a service when a consumer application is started. We recommend that you set the parameter to a value in the range from 3000 to 5000. Otherwise, the error Error code: HSF-0001 may occur when the consumer application is started. However, if this parameter is set, the amount of time required by the startup of the application is prolonged.

    Use the addressWaitTime parameter to separately set the timeout period in milliseconds for a consumer interface in an application.

    Separately set the timeout period for a consumer interface in an application
  • Alternatively, in the application.properties application configuration file, specify a setting in the format of spring.hsf.max-wait-address-times.<Complete service interface name>=<Timeout period for address synchronization to set a timeout period for a service interface, in milliseconds. Set the timeout period
  • If you set the spring.hsf.max-wait-address-time parameter and then restart the application, but the startup of the application is slow, you can analyze the thread stack on the application and the logs in the $USER_HOME/log/configclient/config-client.log and $USER_HOME/log/hsf/ files. To analyze the thread stack, run the jstack <Application JVM process ID> >> threaddump.txt command.