RSocket Broker Use Case in Alibaba Cloud
Find out more about RSocket through an explanation of Alibaba Cloud FaaS offering and a description of the system architecture.
Join the DZone community and get the full member experience.Join For Free
You may also like: Spring Tips: RSocket Messaging in Spring Boot 2.2 [Video]
Alibaba Cloud FaaS Offering
The Alibaba Cloud FaaS offering is part of Alibaba Cloud Service Engine on Alibaba cloud.
The functions are written in Node.js and they can consume various backend services, including java applications, data stores or messaging systems. This offering is more complicated than some other FaaS offerings where each service is standalone and isolated.
To achieve that, a resilient and powerful event-driven architecture is needed.
RSocket is an application protocol carrying reactive streams semantics. Being reactive brings high performance and resiliency to the system.
RSocket is used as the backbone communication protocol. Each component, including the Nodejs services, the backend services, and all the infrastructure pieces in the architecture will communicate via RSocket.
RSocket broker facilitates communication between different components of the FaaS platform. By using the broker deployment model, the components are decoupled from each other yet can have then using HTTP.
Other than communication, the RSocket broker can perform many management functionalities.
Since the RSocket protocol is connection-oriented, the broker keeps the session of the connections. It can serve as a service registry/discovery store. It can perform routing and load balancing. It can perform a health check.
The RSocket broker can also be used to perform traffic shaping, circuit breaking, etc. And since RSocket is a binary protocol, the broker only needs to look at the binary header of the frame to achieve all these features. It can achieve zero-copy.
This is the architecture diagram of the system:
A system diagram.
The Gateways respond to triggering events from users. Proxies are installed in front of backend services. They both can translate the traffic from and to RSocket from their original protocol.
The Node functions talk to RSocket broker directly using RSocket protocol.
The broker's cluster has several brokers. They are independent of each other and do not exchange routing information (for now).
All the gateways, functions and proxies communicate with each other via RSocket broker in RSocket protocol.
With the current deployment, we can achieve peak QPS at 62k/sec, with the daily average invocation of 27 million.
RSocket broker has proven to be reliable and high performance.
Opinions expressed by DZone contributors are their own.