-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Profiling query methods for mapping model #37
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
Conversation
…llection lookup for every request
|
I'd definitely like to see this folded into the actual implementations. It seems that some of the improvements could be made in Spring Data Commons types directly (e.g. holding a name -> property map in |
|
I've just pushed the changes you made applicable for Spring Data Commons as fix for the ticket I created. With that in place the performance gap is close to gone (roughly seeing <0.1% difference). So I wondered whether it's really necessary to apply the rather wild patch to The current state should be available in https://github.com/SpringSource/spring-data-mongodb/tree/performance-%2337. |
|
Yeah sure, I done this CustomConversions changes before I found problem core point, I think. |
|
Or not :) |
|
Ah I reamember, change are wild because this is the fastest way to cache with two dimensions (two parameters) without creating custom Map key. Creating key with two params every time to get something from cache are taking same time as it was without cache. |
|
Okay, then let's consider it. I already had renamed your Finally, what tool did you use to profile the code? I tried jvisualvm but it was not delivering any results comparable to what you got. |
|
Yes, all this is because I use ConcurrentHashMap where we can't use null key or value. I use yourkit java profiler with CPU tracing. But didn't you get any diff in readAfterWarmup test. First time run I get 1% but I run tast (from maven console) 20x and I get avg 5%, so i think it is not accident :) |
This commit includes the MongoDB specific parts for the mapping subsystem performance improvements. Reworked PerformanceTest to output more reasonable numbers. Heavily inspired by Patryk Wasik's contribution at #37. GitHub PR: #37 Conflicts: spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/MappingTests.java
|
Applied in fixes for both DATACMNS-332 and DATAMONGO-682. Thanks for spotting that stuff and doing the heavy lifting. |

I have some time to discover profiler features so I don't want to waste it, so I have played a little bit with spring-data-mongo.
I find that some query to mapping model (after warmup) are little bit uneffective because it always use reflection call or whole collection iteration for example.
So I made some changes to cache this methods call and I gained ~ 20% reduction in query time.
If someone confirm my assumptions, I can make clean patch for this.
Test: org.springframework.data.mongodb.performance.PerformanceTests#readAfterWarmup