RSocket: short introduction

March 17, 2020
RSocket

Description from official RSocket-java repository

RSocket is a binary protocol for use on byte stream transports...
It enables the following symmetric interaction models via async message passing over a single connection..

leaves bits of mystery unless reader is interested enough to skim over lengthy FAQ and motivations documents. This post is one page size summary of distinctive RSocket features that make It a good companion for Http2/GRPC.

Low latency

RSocket provides means for maintaining low latency under high throughput by limiting incoming and outgoing message queue size on both sides of connection:

Often disconnects are inherent for mobile clients. Latency adds up on each hop between content producer and consumer due to cascade of service reconnects. This is addressed by automatic session Resumption enabled on edge servers and clients.

Both are transparent for application layer: because part of the protocol, services implemented on top of RSocket are not concerned about existence of the above.

Any transport

RSocket is session layer protocol, transport is anything able to reliably send bytes in order: from websockets to tcp to unix sockets.

Compatible with http2

RSocket streams are similar and naturally map to http2 streams. RSockets on top of such transport can be routed by web gateways/proxies/loadbalancers.

Both typed and raw byte messages

RSocket-RPC is efficient Protocol Buffers / code generation based RPC system similar to GRPC. It is intended for application services while proxies use byte stream RSockets directly for lower overhead.

Fits existing ecosystem

RSocket streams are semantically equivalent to core types of Reactive Streams compliant projects - on JVM these are projectreactor, rxjava, akka-streams. They simplify protocol implementation, and dependent applications benefit from available libraries and familiar programming model.

Afterword

RSocket is well balanced capabilities-wise. It has pragmatic scope: efficiently transfer byte streams across networks and processes, delivered with small set of orthogonal features (reactive streams, request leasing, resumption). It is easy to comprehend and implement. Moving any feature out would make RSocket not suitable for problems It was intended for. Overloading specification with ad-hoc concepts - message layout, routing, tracing - puts It in odd middleground of lack of focus and questionable interop still without richness expected from application level protocol.

Serving one million streams: RSocket limits on the JVM. Part 1

June 24, 2020
RSocket java

Service concurrency limiting with RSocket request leases

April 9, 2020
RSocket java load-balancer

RSocket for the internet: implementing http/2 based transport

March 18, 2020
RSocket java http2 netty