[JAVA-2110] Performance regression between 2.13 and 3.2 drivers Created: 08/Feb/16 Updated: 20/Dec/19 Resolved: 20/Dec/19 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Performance, Query Operations |
| Affects Version/s: | 3.2.0 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Abbass Marouni | Assignee: | Unassigned |
| Resolution: | Won't Do | Votes: | 3 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||
| Description |
|
We did some benchmarks before upgrading from the 2.13.2 to 3.2.1 and we noticed an important performance gap between the 2. For writing 1 Million documents we noticed a gap of around 5% in favor of the 2.13.2 driver (Using the old com.mongodb.BasicDBObject API or the new CRUD API that uses org.bson.Document). For reading 10 Million documents we noticed a even bigger gap of around 143% using the old API and around 50% for the new API, always in favor of the 2.13.2 driver. What do you think of the benchmarks and do you have your own benchmarks ? Or maybe best practices for the New API. |
| Comments |
| Comment by Jeffrey Yemin [ 20/Dec/19 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I've decided to close this issue. The 3.0 driver was released four years ago now and we have to consider it the new normal. If we find specific areas of improvement that we can make going forward, we can open new issues to address them. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jeffrey Yemin [ 05/Dec/18 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
manan@indeed.com We'd love to see any realistic benchmark numbers that you are able to share. Thanks, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Manan Shah [ 05/Dec/18 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Jeff, I just wanted to update that we saw different results in production after we tested the driver upgrade. The performance for some operations were little bad as compared from the old driver but most operations were fine. I still don't have the accurate data to share but I can get that data from one of our teams if you need. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jeffrey Yemin [ 15/Nov/18 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The data you posted here is different than what you posted on Currently our benchmarks, based on YCSB show around a 30% drop in performance between the 2.13 and 3.8 drivers. We are still evaluating root causes, but we haven't seen degradation as severe as what you're reporting. If you want to proceed further with an analysis, we're going to need you to share your benchmark code. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Manan Shah [ 15/Nov/18 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
You can find the answer to that and much more in | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jeffrey Yemin [ 15/Nov/18 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
manan@indeed.com what version of the driver did you upgrade from and to? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Manan Shah [ 15/Nov/18 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thank you Ian but I would like to have some solution sooner than later as this issue is stalling our upgrades. Here's you can see the performance on the read operations 95th Percentile time when the java driver was upgraded on Wed Nov 14 around 3 am. The difference is so much (from around ~40 ms to > 500 ms) that it is likely going to affect our service SLOs for these operations in production.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Ian Whalen (Inactive) [ 08/Nov/18 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Just a heads up for watchers on this ticket that we've moved the investigation along to our Product Performance team so they can do a deep dive. We'll update this ticket with what comes as the result of that investigation and what any next steps might be. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jeffrey Yemin [ 29/Feb/16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
OK, thanks Abbass. As we uncover further causes for performance degradation, we'll link them to this ticket. Regards, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Abbass Marouni [ 29/Feb/16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Jeff, So I did rewrote the benchmark to use some "real-world" document, here's what I came up with :
And here's the new parsing code for the Legacy API and the new API : Legacy API :
New API :
Here's also the bean class :
Here are the results (time in ms for reading 10 million documents) : 2.13.2 LEGACY API : 49052 3.1.1 New API : 53341 We got closer results this time but the 2.x drivers still perform better than 3.x (around 10%). I think that we'll stick to the 2.14.1 driver for the time being and we'll upgrade the driver later on. Abbass, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jeffrey Yemin [ 27/Feb/16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Abbass, The 2.x BSON decoder has an optimization for single character ASCII strings, which is not present in the 3.x driver. Are single character field names what you use in actual applications, or just for this microbenchmark? If the former, please re-run the benchmark with documents that more closely represent ones you would use in a production application. Using multi-character strings won't eliminate all of the performance degradation you're seeing, but profiling shows that it is a significant factor. Regards, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jeffrey Yemin [ 27/Feb/16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Abbass, To help us get to the root cause, please provide a representative document from the collection, or more than one if there is a variety. Regards, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jeffrey Yemin [ 26/Feb/16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Abbass, Would you mind running your benchmark against the 3.1.1 version of the driver? Regards, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Abbass Marouni [ 26/Feb/16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Jeff, I got the new 3.2.2 driver and reran my tests(same code as above). 2.13.2 LEGACY API : 9669 The new 3.2.2 is still 2 times slower than the 2.X drivers. I'm wondering if this is due to connection establishment between 2.X and 3.X or if our test data (10 million documents with simple types) is not enough. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jeffrey Yemin [ 10/Feb/16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Abbass, There is no fixed release date but it shouldn't be more than a couple of weeks and likely sooner. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Abbass Marouni [ 10/Feb/16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks Jeff, We were hesitant to upgrade the driver so now we'll wait for the 3.2.2, and it's good to see the issue being acknowledged quickly. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jeffrey Yemin [ 10/Feb/16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Since there may be multiple issues here, I separated out the first one as | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jeffrey Yemin [ 09/Feb/16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Never mind, I think I see the problem. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jeffrey Yemin [ 09/Feb/16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Would you mind executing your benchmarks against the 3.0 server and posting the results here? Regards, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Abbass Marouni [ 09/Feb/16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Test environment : Benchmark code for Reading 10 million documents : New API with 3.2.1 driver
Old API with 2.13.2 driver
The average of 3 runs : New API with 3.2.1 driver : 27710 ms Please note that we got the same results when using the following parsing code with the new API + 3.2.1 driver :
Best Regards, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jeffrey Yemin [ 08/Feb/16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Can you provide the benchmark code and the relevant details about the test environment? Regards, |