Skip to content

Improve reactive Repository save operation flow #4838

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

Closed
christophstrobl opened this issue Nov 19, 2024 · 2 comments
Closed

Improve reactive Repository save operation flow #4838

christophstrobl opened this issue Nov 19, 2024 · 2 comments
Assignees
Labels
type: enhancement A general enhancement

Comments

@christophstrobl
Copy link
Member

This issue is a follow up on #4804 to improve performance of the save operation by splitting executions in a way to make sure the transaction initialising one runs before any of the potential others, as outlined by @chemicL:

Flux.just(firstItem)
    .flatMap(this::save)
    .concatWith(Flux.fromIterable(remainderOfItems)
            .flatMapSequential(this::save)
    )
@christophstrobl christophstrobl added the type: enhancement A general enhancement label Nov 19, 2024
@christophstrobl christophstrobl added this to the 4.5 M1 (2025.0.0) milestone Nov 19, 2024
@christophstrobl christophstrobl self-assigned this Nov 19, 2024
mp911de pushed a commit that referenced this issue Nov 28, 2024
mp911de added a commit that referenced this issue Nov 28, 2024
Switch to Flux.fromIterable(…) from StreamUtils in deleteAll(Iterable). Use switch expressions, refine toList/toCollection arrangement. Guard tests against absent ReplicaSet.

See #4838
Original pull request: #4843
@mp911de mp911de changed the title Improve reactive save operation flow. Improve reactive Repository save operation flow Nov 28, 2024
@kratikothari95
Copy link

kratikothari95 commented Feb 3, 2025

Hi @christophstrobl , I am facing the same issue when I am trying to do Flux(fromIterable(listofAccounts).buffer(1000).flatMap(acc->{
repo.saveAll(accounts)
.subscribeOn(Schedulers.parallel));
)}

Here I am also getting 251 Error : NoSuchTransaction , transaction been aborted.
Can you please help.
Also I am trying for parallelly saving documents into mongodb to improve saveAll performance for large number of documents.
I am using spring-boot-starter-data-mongodb-reactive

@christophstrobl
Copy link
Member Author

@kratikothari95 which version are you using? If there's a problem with one of the currently supported bits, please open a new ticket referencing this one and make sure to provide a complete minimal sample (something that we can unzip or git clone, build, and deploy) that reproduces the problem.

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

Successfully merging a pull request may close this issue.

2 participants