[JAVA-3973] Regression in reactive streams implementation memory consumption Created: 28/Jan/21 Updated: 28/Oct/23 Resolved: 11/Feb/21 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Reactive Streams, Scala |
| Affects Version/s: | 4.2.0 |
| Fix Version/s: | 4.2.1 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Fred Roth | Assignee: | Ross Lawley |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
linux, OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.9.1+1, mixed mode), atlas |
||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
An upgrade from mongo-java-driver (and mongo-java-driver) from 4.1.1 to 4.2.0 lead to increased memory consumption and decreased performance. (Jobs taking massively longer than before) We solved the issues by rolling back to 4.1.1. We don't have minimal reproducing examples but it is very visible for usecases where we stream a huge amount of documents reading from the database using reactive streams. The changelog states that you exchanged the internal reactive-streams implementation so maybe it has something to do with this. |
| Comments |
| Comment by Githook User [ 05/Apr/21 ] |
|
Author: {'name': 'Valentin Kovalenko', 'email': 'valentin.kovalenko@mongodb.com', 'username': 'stIncMale'}Message: Backport to 4.2.x
Ensures that all sessions are returned to the pool
Before the changes made within The approach with using startAtOperationTime to ensure that Co-authored-by: Ross Lawley <ross.lawley@gmail.com> |
| Comment by Githook User [ 24/Mar/21 ] |
|
Author: {'name': 'Valentin Kovalenko', 'email': 'valentin.kovalenko@mongodb.com', 'username': 'stIncMale'}Message: Guarantee that ChangeStreamPublisher for a collection completes after dropping the collection (#689) Before the changes made within The approach with using startAtOperationTime to ensure that
|
| Comment by Jeffrey Yemin [ 16/Feb/21 ] |
|
joao@nezasa.com by the end of this week. |
| Comment by João Ferreira [ 11/Feb/21 ] |
|
Also fixes our problem. Any ETA for 4.2.1? |
| Comment by Ross Lawley [ 11/Feb/21 ] |
|
Thanks frederick.roth@breuninger.de for testing. |
| Comment by Fred Roth [ 11/Feb/21 ] |
|
Hi Ross, I just ran our workload with 4.1.1, 4.2.0, and 4.2.1-SNAPSHOT. The performance and memory footprint of the new 4.2.1-SNAPSHOT version is very similar to 4.1.1. And therefore way better than 4.2.0. So from my point of view it seems to be fixed. Thanks for your effort Fred |
| Comment by Ross Lawley [ 11/Feb/21 ] |
|
Hi frederick.roth@breuninger.de & jtjeferreira@gmail.com, Just to let you know that the 4.2.1-SNAPSHOT has been released with an improvement in the BatchCursorPublisher. If possible it would be great if you could test this fix and provide feedback before the release. Ross |
| Comment by Githook User [ 03/Feb/21 ] |
|
Author: {'name': 'Ross Lawley', 'email': 'ross.lawley@gmail.com', 'username': 'rozza'}Message: Fix reactive streams batch cursor regression. (#652) The BatchCursorPublisher now waits for demand to be signalled before The batch cursor publisher also internally respects the batch size.
|
| Comment by Ross Lawley [ 02/Feb/21 ] |
|
That's great, internally we still use the BufferAsyncSink however, we have identified a change in how demand is signalled and processed, which can lead to excessive buffering. Ross |
| Comment by João Ferreira [ 02/Feb/21 ] |
|
Hi We also see something similar when upgrading to 4.2. Rolling back to 4.1.1 seems to fix it. I dont have a minimal reproducer, but I have a an heapdump which I can share some screenshots: Overview
List object with outgoing references
|
| Comment by Ross Lawley [ 29/Jan/21 ] |
| Comment by Ross Lawley [ 28/Jan/21 ] |
|
Hi frederick.roth@breuninger.de, No problems, I inferred that you were using Scala but as the main change has been the introduction of Project Reactor I'll base my investigations there to begin with. Ross |
| Comment by Fred Roth [ 28/Jan/21 ] |
|
My colleague spotted a typo in my description: I wanted to write "mongo-java-driver (mongo-scala-driver)" meaning: we use the scala driver using the underlying reactive streams java driver. |
| Comment by Ross Lawley [ 28/Jan/21 ] |
|
Firstly, thanks for the report frederick.roth@breuninger.de and bring this to our attention. Secondly, apologies for causing a performance regression. We'll investigate and will report back. Ross |