eclipse-vertx / vert.x

Vert.x is a tool-kit for building reactive applications on the JVM
http://vertx.io
Other
14.18k stars 2.05k forks source link

Websocket batch processing / read completion event #5178

Open phraktle opened 2 months ago

phraktle commented 2 months ago

Describe the feature

Facilitate processing multiple available messages from a websocket in a batch. A possible solution is to provide a read completion event which indicates that all currently available messages from the network buffer were consumed.

Use cases

This allows improving latency in high-load / bursty consumers. For example, when consuming a real-time API with batch processing the consumer may skip messages to act only on the latest one in case of a burst / hiccup, effectively shedding load without introducing additional latency.

Contribution

Since the design has to consider feature interactions, such as back-pressure, I would request a core developer to look into this. Happy to provide support with review and testing.

kovax commented 2 months ago

I guess this could be available to any socket/streams.

vietj commented 2 months ago

@kovax that's right

vietj commented 2 months ago

I think the major work is define how that works with back-pressure pause/fetch/resume overall in a consistent manner