Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync fusion support in reworked lazy mono stack #3136

Open
OlegDokuka opened this issue Aug 3, 2022 · 1 comment
Open

Sync fusion support in reworked lazy mono stack #3136

OlegDokuka opened this issue Aug 3, 2022 · 1 comment
Assignees
Labels
type/enhancement A general enhancement
Milestone

Comments

@OlegDokuka
Copy link
Contributor

Sync fusion can be a nice improvement for the reworked lazy mono for scenarios where the source is static data source

follow up for #3081

@reactorbot reactorbot added the ❓need-triage This issue needs triage, hasn't been looked at by a team member yet label Aug 3, 2022
@OlegDokuka OlegDokuka added type/enhancement A general enhancement and removed ❓need-triage This issue needs triage, hasn't been looked at by a team member yet labels Aug 3, 2022
@simonbasle simonbasle added this to the 3.5.x backlog milestone Aug 8, 2022
@chemicL chemicL self-assigned this Aug 29, 2022
@OlegDokuka
Copy link
Contributor Author

OlegDokuka commented Oct 27, 2022

Disposable d = Mono.fromFuture(future) // source is fn 
                                    .flatMap() // flat map can not fuse since the source is just push based observable
                                    .subscribe();
                                    // 5 sec wait
                                    d.dispose() // after some time

NO FUSION

subscriber call source.subscribe()
source call subscriber.onSubscribe()
subscriber call subscription.requestFusion()
subscriber call subscription.request()
subscription call subscriber.onNext()
subscription call subscriber.onComplete()

Disposable d = Mono.fromFuture(future)
                                    .cache() // can be represented as a queue
                                    .flatMap() // flat map fuses with the source and treat it as a queue
                                    .subscribe();
                                    // 5 sec wait
                                    d.dispose() // after some time

ASYNC FUSION (makes no sense, just brings redundancy)

subscriber call source.subscribe()
source call subscriber.onSubscribe()
subscriber call subscription.requestFusion()
subscriber call subscription.request()
subscription call subscriber.onNext(null)
subscriber call subscription.poll() // extra step here
subscription call subscriber.onComplete()

Disposable d = Mono.fromCallable(future) // source is fn 
                                    .flatMap() // flat map fuses with the source is callable
                                    .subscribe();
                                    // 5 sec wait
                                    d.dispose() // after some time

Callable macro fusion (a.k.a MONO SYNC FUSION) (means value is generated synchronously via function call or scalar)

subscriber call source.subscribe()
subscriber call source.call()

@chemicL chemicL modified the milestones: 3.5.x Backlog, 3.6.x Backlog Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants