Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Real time aplicaton, Reactor Netty vs Netty

I know the second one is based on the first one but I'm curious about what are differences except API? Is it possible to establish push model connection with Reactor? I'm going to create a real-time app so I have to get the one most suitable for this purpose. I will appreciate any help :)

like image 338
minizibi Avatar asked Oct 17 '22 12:10

minizibi


1 Answers

The API in this case is much more than syntactic sugar. It propagates the Reactive Contract. The Reactive Contract guarantees that a Producer won't produce more tasks/messages/whatever than a Consumer can consume without choking. This guarantees optimal usage of processing power by limiting thread-switching (I oversimplify to remain short). At Netty level, propagation of the Reactive Contract means not sending TCP acknowlegement until the data on the wire has been processed.

I don't know what "real time" means for you but Reactor is probably your friend. Anyways its great API makes sense for any application with processing that can split in several stages.

I've written my own library above Netty so I know a bit what I'm talking about. The Netty connector spits Command objects that can go into a Reactor Flux, but I offer no mean to propagate the Reactive Contract. This was a few years ago, at a time where Reactor Netty was called Reactor IO and it was in its infancy. The API has been completely rewritten since.

So my advice is: if you need the Reactive Contract, go ahead with Reactor Netty.

This may be non-trivial, as described in the issue Dynamically merging Fluxes. But there may be a simple answer to my question, and (depending on your application) you may just process every request in its own Flux.

like image 172
Laurent Caillette Avatar answered Nov 02 '22 23:11

Laurent Caillette