All Products
Search
Document Center

HSF overview

Last Updated: Mar 25, 2019

High-speed Service Framework (HSF) is a distributed RPC service framework widely used within the Alibaba Group.

HSF connects different business systems, decoupling the implementation of the systems from each other.HSF unifies service publishing/call methods from the perspective of distributed applications, helping you conveniently and quickly develop distributed applications. It provides public function modules, which avoid complex technical details in distributed systems, such as remote communication, serialization implementation, performance loss, and synchronous/asynchronous call method implementation.

HSF architecture

As a client-side RPC framework, HSF itself has no server cluster. All HSF service calls are point-to-point between the consumer and the provider.However, HSF must work with the following external systems to implement the complete distributed service system.

HSF architecture

  • Address registration center

    HSF relies on the address registration center for service discovery. Without the address registration center, HSF can only make simple point-to-point calls.The service provider cannot advertise its service information to others. The service consumer may know which services to call, but cannot obtain information about the instances providing these services.In this case, the address registration center serves as a medium for the discovery of service information.The role of address registration center is played by ConfigServer.

  • Persistent configuration center

    The persistent configuration center is used to store various governance rules of HSF services. At startup, the HSF client subscribes necessary service governance rules, such as routing rules, grouping rules, and weight rules, from the persistent configuration center to intervene in the address selection logic of the calling procedure based on the rules.The role of persistence configuration center is played by Diamond.

  • Metadata storage center

    Metadata refers to the list of methods, parameter structure, and other information related to HSF services. Metadata does not affect the calling procedure of HSF. Therefore, the metadata storage center is not required.However, to ensure convenient service maintenance, at startup the HSF client submits the metadata to the metadata storage center for further maintenance.The role of metadata storage center is played by Redis.

Functions

As a distributed RPC framework, HSF supports multiple service calling methods:

  • Synchronous calls

    By default, the HSF client consumes services by synchronous calls, and the client’s codes must synchronously wait for the returned results of calls.

  • Asynchronous calls

    For the client that calls HSF services, it is not always necessary to synchronously wait for the returned results of calls.For such services, HSF supports asynchronous calls, releasing clients from being congested synchronously in HSF calling operations.There are two kinds of asynchronous HSF calls:

    *Future call: The client obtains the returned results of calls by HSFResponseFuture.getResponse(int timeout) when needed.

    • Callback call: The callback call utilizes the callback mechanism provided by HSF. When specified HSF services are consumed and the results are returned, the HSF framework calls the HSFResponseCallback API used by the consumer to obtain the call results. The client obtains the results by using the callback notification.
  • Generic calls

    For a typical HSF call, the HSF client has to perform a programming call with the API of the second party library of the service to obtain the returned results.In contrast, generic call means to initiate HSF call and obtain returned results, independent of the second party library of the service.For some platform-based products, generic calls can effectively reduce their dependence on second party libraries and support lightweight system running.

  • HTTP calls

    HSF can advertise service information over HTTP, so that non-Java clients can call HSF services over HTTP.

  • Trace Filter extension

    HSF, designed with a built-in call filter, can actively find and integrate the user’s call filter extension point into HSF trace, enhancing the convenience of HSF request extension.

Application development methods

Under HSF, you can use Ali-Tomcat and Pandora Boot to develop applications.

  • Ali-Tomcat: Relying on Ali-Tomcat and Pandora, this method provides complete HSF functions, including service registration and discovery, implicit parameter passing, asynchronous call, generic call, trace Filter extension, rate limiting and degradation, and distributed tracing.In this method, applications must be deployed with WAR packages.

  • Pandora Boot: Relying on Pandora, this method provides complete HSF functions, including service registration and discovery, implicit parameter passing, asynchronous call, generic call, trace Filter extension, rate limiting and degradation, and distributed tracing.Applications can be packaged and deployed as JAR packages that run independently.