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

Fix Java 11 performance bug #316

Merged
merged 19 commits into from
Jun 4, 2024
Merged

Fix Java 11 performance bug #316

merged 19 commits into from
Jun 4, 2024

Conversation

eupp
Copy link
Collaborator

@eupp eupp commented Apr 29, 2024

Closes #308

This PR fixes the performance problem accidentally introduced in #296 , that manifested on our Java 11 CI builds.
The root cause of the problem and the solution are described below.

The problem was related to the JVM classes re-transformation, performed by the Java agent.
For model checking instrumentation mode, the class re-transformation was performed lazily on demand.
However, for the stress strategy, all the loaded classes were re-transformed eagerly for each Lincheck test.
During a long JVM run (e.g. in case of our CI builds), a lot of classes can be loaded to the JVM, and for each Lincheck test run, the Lincheck JVM agent in the stress model would try to re-transform them.

However, for the stress strategy we actually only need to intercept the suspension points, that is calls to certain internal coroutine methods. The observation is that most of the loaded classes would not contain these calls, so there is no need to constantly re-transform them.

So the solution, implemented in this PR, is to remember all the loaded classes that actually have coroutine calls inside them, and only re-transform these classes (or newly loaded classes) on subsequent Lincheck agent installations.

@eupp eupp requested a review from ndkoval April 29, 2024 14:42
eupp added 12 commits May 27, 2024 16:17
Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
…Stress strategy

Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
…entAllClasses`

Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
…ninstall` call

Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
eupp added 2 commits May 27, 2024 20:03
Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
@ndkoval ndkoval linked an issue May 28, 2024 that may be closed by this pull request
eupp added 3 commits May 30, 2024 11:30
Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
@eupp eupp requested a review from ndkoval May 30, 2024 10:54
Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
@eupp eupp requested a review from ndkoval May 30, 2024 16:15
@@ -11,15 +11,12 @@
package org.jetbrains.kotlinx.lincheck.transformation.transformers

import org.jetbrains.kotlinx.lincheck.transformation.*
import org.jetbrains.kotlinx.lincheck.transformation.ManagedStrategyMethodVisitor
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please always use "*" in imports

Signed-off-by: Evgeniy Moiseenko <evg.moiseenko94@gmail.com>
@eupp eupp merged commit fadd43c into develop Jun 4, 2024
15 checks passed
@eupp eupp deleted the java-11-perf branch June 4, 2024 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate performance issues due to Java agents on Java 11 builds
2 participants