1

Is it possible to use AWS Application Loadbalancer for RSocket?

An AWS Application Loadbalancer can also be used for WebSocket connections and my project uses RSocket with WebSocket as its transport. This made me wonder if it is possible to use this loadbalancer for RSocket aswell. On one hand I would think it is possible to use this loadbalancer, as it only receives a connection and passes this to the target RSocket server. On the other hand, if all RSocket frames go through the loadbalancer, it might not know how to handles these frames, which would make it not possible to use.

I couldn't find much about RSocket and loadbalancing online besides this post .But this is client side loadbalancing and I was looking for server side loadbalancing.

And this post .But this uses LoadBalanceSocketClient while I want to find out if an AWS Application Loadbalancer can be used.

Here follows a simple diagram of what I would like to have (if possible): The RSocket client connects to the loadbalancer which passes the connection to a RSocket server (for example server A). Then the client and RSocket server A can communicate.

enter image description here

RatManMan
  • 63
  • 6

1 Answers1

1

AWS will see this as a typical websocket service. So as long as it lets HTTP/1.1 connections through and lets them upgrade to WebSocket there shouldn't be a problem. This is very standard so it shouldn't be an issue. Ideally it won't see individual frames of the traffic, and you app will handle all frames on a single WebSocket connection. But it looks like the API Gateway support does deal with individual messages https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-set-up-websocket-deployment.html. You should ignore the RSocket client load balancing, and focus on AWS WebSocket routing.

As an example, with GCP (instead of AWS) the complexity is that this bumps you up from AppEngine Standard to Flexible. The demo site https://demo.rsocket.io/ is deployed to GCP and exposes websockets.

The additional kink, is that you possibly want stateful routing if you want client resumption.

Yuri Schimke
  • 12,435
  • 3
  • 35
  • 69
  • So you are saying that it should be possible to use a load balancer, because it doesn't deal with the RSocket frames, but it is not possible to use API Gateway as it does handle incoming frames? – RatManMan May 12 '21 at 09:26
  • 1
    Yes, should definitely be possible to use a load balancer. It wouldn't make sense if it sprayed messages around. I hope API gateway doesn't break it, but it's higher risk because it could mutate the messages. – Yuri Schimke May 12 '21 at 09:32
  • The reason why I personally doubt that API Gateway is able to support RSocket, is because the WebSocket support it has, mainly comes down to managing the stateful WebSocket connections and executing integrations (for example a Lambda) based on message content. Which to me sounds like the RSocket frames are never directly sent to an integration, which would mean that the extra features RSocket has, as compared to pure WebSocket, go lost. But to be honest I don't have a lot of experience with API Gateway nor RSocket so I am not 100% sure. What do you think? – RatManMan May 12 '21 at 09:55