reactor/reactor-core

Improve Flux.timeout efficiency

Open

#2.845 geöffnet am 21. Nov. 2021

Auf GitHub ansehen
 (17 Kommentare) (3 Reaktionen) (0 zugewiesene Personen)Java (1.164 Forks)batch import
area/performancefor/user-attentionhelp wanted

Repository-Metriken

Stars
 (4.748 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 16T 15h) (25 gemergte PRs in 30 T)

Beschreibung

Current implementation uses parallel scheduler by default which is in essence a ScheduledThreadPoolExecutor which has the task queue guarded by ReentrantLock, which means two trips through said lock per signal on average

After looking at Netty's https://github.com/netty/netty/blob/4.1/handler/src/main/java/io/netty/handler/timeout/IdleStateHandler.java there appears to be a way to do fewer timeout task reschedules if you let go of the idea illustrated by the current marble diagrams (new signal cancels the previous timeout task)

WDYT? this really prevents Flux.timeout from being useful with high-frequency publishers which may occasionally stall

suggestion inspired by https://gitter.im/reactor/reactor?at=61968a44197fa95a1c7adf05

Contributor Guide