Skip to content
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

Lazy loading - spends 50% of time in Spring internal code #4021

Open
alexbudarov opened this issue Dec 24, 2024 · 0 comments
Open

Lazy loading - spends 50% of time in Spring internal code #4021

alexbudarov opened this issue Dec 24, 2024 · 0 comments
Labels
candidate Possible candidate for future releases in: data size: M type: bug Something isn't working

Comments

@alexbudarov
Copy link

Environment

Jmix version: 2.3.4, 2.4.2.

Bug Description

Lazy loading mechanism spends significant portion of time inside of Spring internals, not in the JPA / JDBC / network I/O code.

Steps To Reproduce

  • Load and lazily traverse an entity graph:
    20 Owners -> 20 Pets each -> 20 Visits each

For me: it took 9467 ms.

  • As the test starts, quickly connect with Visualvm to the gradle tests process, and take CPU sampling during this traversion.

Current Behavior

CPU sampling report shows that around 50% of sampled time is spent inside of Spring classes.
See screenshot.

  • walkThrough method -- takes 9499 ms
  • 2 invocations of ContextAnnotationAutowireCandidateReoslver$1.getTarget - take 3499 + 804 = 4303 ms.
  • DefaultListableBeanFactory.getBean - takes 300 ms more.

In total it is 4603 ms = 48% of the total method execution.

It looks inefficient to spend so much CPU time there.
And it is a real CPU activity, not sleeping waiting for the network I/O.

image

Expected Behavior

Majority of time should be spent in awaiting for database response.

Sample Project

Modified petclinic sample:

jmix-petclinic.zip

Launch test class: io.jmix.petclinic.LazyLoadingPerformanceTest

@alexbudarov alexbudarov added triage Issue is waiting for triage type: bug Something isn't working labels Dec 24, 2024
@glebfox glebfox added candidate Possible candidate for future releases size: M in: data and removed triage Issue is waiting for triage labels Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
candidate Possible candidate for future releases in: data size: M type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants