MongoTemplate performance issue during call to find()
clucacicerqlar opened this issue · 4 comments
While using spring-data-mongodb version 4.2.12, Ive noticed that MongoTemplate during a call to find/doFind also performs getMappedSortObject
using the original query
object. The resulting variable mappedSort
is also not even used if isDebugEnabled
is FALSE.
In some cases, this call to getMappedSortObject ends creating lots of PropertyReferenceException which end up calling Throwable fillInStackTrace and perform native/synchronized code so lot of time spent for no reason building stack traces?
Thank you @clucacicerqlar. The 4.2.x
line is already out of OSS support.
If the problem exists on more recent versions please provide us with a complete minimal sample (something that we can unzip or git clone, build, and deploy) that reproduces the problem and maybe some flame graphs or other data that help us understand the issue better.
hi @christophstrobl thank you for the reply, indeed the issue is there even in the latest versions, see below.
RE sample, you can see above, its problem is pretty easy to spot. the variable Document mappedSort
is never used, outside of below IF, and neither in the return function call. so its dead code
thank you @clucacicerqlar for bringing this to our attention!