High-Speed Service Framework (HSF) is a distributed remote procedure call (RPC) service framework that is widely used by Alibaba Group.
HSF connects different business systems and decouples the implementation dependencies between them. HSF unifies the service publishing and call methods for distributed applications, helping you conveniently develop distributed applications. HSF provides or uses common function modules, and frees you from various complex technical details involved in distributed architectures, such as remote communication, serialization, performance loss, and implementation of synchronous and asynchronous calls.
HSF is an RPC framework that is provided only for clients. Therefore, it does not have clusters at servers. All HSF services are called between service consumers and service providers in a point-to-point method. However, HSF must depend on the following external systems to implement a complete distributed service system.
- Service provider
A service provider binds port 12200 to receive requests, provide services, and publishes address information to an address registry.
- Service consumer
A service consumer subscribes to services by using the address registry and initiates calls based on the subscribed address information. The address registry is not involved in calls.
- Enterprise Distributed Application Service (EDAS) address registry
HSF depends on the address registry for service discovery. If the address registry is not used, HSF can only implement simple point-to-point calls.
The service provider cannot expose service information. The service consumer may have specified the service to be called but cannot obtain the service. The address registry serves as a medium for service information and provides the service registration and discovery feature.
- Enterprise Distributed Application Service (EDAS) persistent configuration center
The persistent configuration center is used to store governance rules of HSF services. Upon startup, the HSF consumer subscribes to required service governance rules, such as routing rules, grouping rules, and weighting rules, from the persistent configuration center to intervene in the address selection logic of the call procedure based on the rules.
- Enterprise Distributed Application Service (EDAS) metadata storage center
Metadata includes information related to HSF services, such as methods and parameter structures. Metadata does not affect the call processes of HSF services. Therefore, the metadata storage center is optional. To ensure convenient service maintenance, upon startup, the HSF consumer reports the metadata to the metadata storage center for further maintenance.
- Enterprise Distributed Application Service (EDAS) console
The Enterprise Distributed Application Service (EDAS) console interconnects the registry, persistent configuration center, and metadata storage center. The console provides service O&M features, including service query and service governance rule management. This improves R&D efficiency and O&M convenience for HSF services.
- Synchronous calls
By default, an HSF consumer uses synchronous calls to consume services, and the consumer must wait for the returned results of each call.
- Asynchronous calls
An HSF consumer does not need to synchronously wait for the returned results of all service calls. HSF supports asynchronous calls so that the consumer does not have to synchronously wait for the returned results of calls. In HSF, asynchronous calls can be made by using the Future and Callback methods.
- Future calls
The HSF consumer calls HSFResponseFuture.getResponse (int timeout) to obtain the returned results of calls.
- Callback calls
The calls are made by the Callback method that is internally provided by HSF. After the specified HSF service is consumed and the results are returned, the HSF framework calls the
HSFResponseCallbackmethod. The consumer then obtains the call results based on callback notifications.
- Future calls
- Generic calls
For a general HSF call, the HSF consumer performs a programmatic call based on API programming in the second-party package of the service to obtain the returned results. However, a generic call initiates an HSF call and obtains returned results by using a method that is independent of the second-party package of the service. For platform-based products, generic calls can effectively reduce dependencies on second-party packages and implement lightweight system operation.
- Trace filter extension
HSF is designed with a built-in call filter and can actively find and integrate your call filter extension into HSF call traces, enhancing the convenience of HSF request extension.
Application development methods
HSF allows you to develop applications in Ali-Tomcat and Pandora Boot.
- Ali-Tomcat: This method depends on Ali-Tomcat and Pandora Boot, and provides complete HSF features such as service registration and discovery, implicit parameter passing, asynchronous calls, generic calls, and trace filter extension. Applications must be deployed in the format of WAR packages.
- Pandora Boot: This method depends on Pandora and provides comparatively complete HSF features, such as service registration and discovery and asynchronous calls. Applications can be compiled into executable JAR packages for deployment.