-
Notifications
You must be signed in to change notification settings - Fork 307
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
Cache common PersistentProperty attributes #1082
Cache common PersistentProperty attributes #1082
Conversation
…onstructor means there only needs to be one evaluation
bf3aebf
to
d5813c7
Compare
Thanks a lot. Whenever we experience performance issues, we'd rather apply some caching in the sense of adding that aspect on top of the class, not inside of it. That being said, let's introduce a caching variant of |
Sure, I’ll implement that. By the way, I’ve noticed that there is a whole bunch of type checking done for every row that seems like it could be done once on the first query of that type. The datastax driver also skips most of these type checks in a similar manner. Does that sound reasonable? Do you have any plans along those lines? The reason I ask is because I’m observing 3-5x worse performance compared to the datastax mapper. |
Do you have any pointers you're referring to? We are always happy to remove performance bottlenecks. |
It's worth trying to skip external type information and call High self-times in |
I had a look at CachingMongoPersistentProperty but I think there may be some multithreading issues if those fields are not guarded or at least volatile when used in a potential CachingCassandraPersistentProperty. Since the property is stored once, two queries at the very start before the fields have been initialised could end up colliding and causing double lookups at best or data corruption at worst. Is there some other way these fields are guarded that I missed? There's also the issue of pushing the primitive booleans to wrapper Booleans and the need for an additional object wrapper over Ordering since it is nullable which would cause increased complexity and performance hits. |
I tried out your suggestion of removing the getCollection special case in the RowReader and letting it fall to getObject. It seems to perform better. I was at ~8% cpu after vs ~10% before the change. |
Is there any update here? We'd like to continue with that change. Unless you can/want to provide an updated variant of the code, we'd move forward and apply the caching changes ourselves. |
Sorry, I got pulled into other projects. Go ahead with your changes please. I’ll be sure to re-investigate after they’ve gone in to look for more hot points. |
We now use CachingCassandraPersistentProperty to pre-compute primary key and embedded flags to reduce computation load when using these properties. Resolves #1082
We've fixed this one without merging the actual pull request. |
Moving these to the constructor means the annotation evaluation only needs to happen once per type rather than for every mapped row.
![image](https://user-images.githubusercontent.com/17055695/104682136-d69c6400-56a8-11eb-8484-b4eee7d593db.png)
This should result in a ~4% improvement under some use cases as shown.