Backend Development 9 min read

Understanding RSocket: Definition, Production Practice, and Business Development Advantages

This article introduces RSocket, examines its production performance tests with Dubbo and Spring Flux, explains the protocol’s four interaction models and key features, and discusses the practical benefits of using RSocket for reactive business development and future back‑pressure scenarios.

Ctrip Technology
Ctrip Technology
Ctrip Technology
Understanding RSocket: Definition, Production Practice, and Business Development Advantages

1. Introduction to RSocket

At QCon 2019 in Beijing, the author first learned about RSocket, noting Netifi's claim that using RSocket‑based brokers can reduce Istio costs from $3,495 to $388 per month while delivering a ten‑fold performance boost in a 40,000 RPS scenario.

Netifi’s broker, built on the RSocket protocol, eliminates the need for separate middleware such as monitoring, service discovery, health checks, and load balancing, even across multi‑cloud deployments (e.g., Google Cloud ↔ Amazon AWS).

Istio experts have reported that an RSocket‑based service mesh can be up to ten times faster than Istio, prompting the question of whether RSocket truly delivers such performance gains.

2. RSocket Production Practice

The team decided to evaluate RSocket in production, comparing it with existing Dubbo 2.7 implementations. Supported RSocket frameworks include Spring Flux.

Dubbo 3.0 snapshot:

Performance tests compared Dubbo 2.7 (sample code shown as images) with Dubbo 3 and Spring Flux. Tests at 200, 400, and 800 QPS showed similar CPU, memory, and response times, raising doubts about any performance improvement.

3. Definition of RSocket

RSocket is a binary, bidirectional, multiplexed, message‑based protocol built on Reactive Streams flow control. It defines four interaction models:

request‑response: one request, one response (like traditional REST).

fire‑and‑forget: request without expecting a result.

request‑stream: one request, multiple streamed results.

channel: bidirectional streams where both client and server can send multiple messages.

Key characteristics:

Cancelable: both requests and responses can be cancelled, freeing resources.

Resumable: a paused interaction can be resumed later.

Leasing (back‑pressure): the responder can control the request rate.

RSocket implementations in Java typically use long‑lived TCP connections, similar to Dubbo, but follow a stricter protocol specification.

Because Dubbo 3 adopts RSocket, the lack of observed performance gains is explained by the fact that the change mainly replaces HTTP with TCP without altering the underlying communication pattern.

4. Business Development Advantages of RSocket

For developers, RSocket simplifies reactive service definitions. For example, an interface that takes a Mono and returns a Mono can be declared as follows (image):

Mono is a Reactor type that emits at most one item. If the application already uses non‑blocking code, all Reactor APIs (including Flux ) can be leveraged directly. Converting existing CompletableFuture returns (as in Dubbo 2.7) to Mono is straightforward.

Using Flux enables streaming multiple results, which is impossible with CompletableFuture . This supports scenarios such as a service A calling B and C, where C is fast and D is slow; with request‑stream, A can receive C’s result immediately and later receive D’s result, improving resource utilization.

Dubbo can also implement request‑stream patterns (image of Dubbo code).

Overall, the reactive functional programming style reduces code complexity and improves readability.

5. Outlook for RSocket

Back‑pressure, a core feature of reactive programming, allows upstream services to limit calls when downstream services are overloaded. This can reduce unnecessary or duplicate requests from mobile apps, saving bandwidth and hardware costs. Facebook engineers have applied similar techniques in their client‑server communication.

Future work includes leveraging RSocket’s back‑pressure to implement smarter request throttling in real‑world applications.

References

RSocket and Spring Cloud Gateway slides

Project Reactor reference

InfoQ article on RSocket at Facebook

MicroservicesBackend DevelopmentPerformance Testingreactive programmingRSocket
Ctrip Technology
Written by

Ctrip Technology

Official Ctrip Technology account, sharing and discussing growth.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.