Working group: Class loading in Quarkus #43749
Replies: 9 comments 13 replies
-
How does it differ from the working group https://github.com/orgs/quarkusio/projects/30? Should it be merged? |
Beta Was this translation helpful? Give feedback.
-
I think it's reasonable to keep these separate, in the interests of having smaller scopes. https://github.com/orgs/quarkusio/projects/30 covers test classloading specifically, whereas the proposed WG has the broader remit of "all classloading." However, since there's a substantial overlap, I'd put in a plea to sequence the working groups, and not start serious work on the broader classloader rewrite until https://github.com/orgs/quarkusio/projects/30 is mostly done. Otherwise there's likely to be a lot of rework-cost. |
Beta Was this translation helpful? Give feedback.
-
Dynamic module loading with JPMS support does seem possible; here's a fairly minimal prototype modeled after the |
Beta Was this translation helpful? Give feedback.
-
I'm investigating to support "dynamic loading" with classloaders management. The idea is to focus on Karaf key features (hot deployment/deployers, classloaders management, service registry/discovery, ...) by leveraging Quarkus. So, happy to participate in this discussion. I will share on https://github.com/jbonofre/quaraf soon. |
Beta Was this translation helpful? Give feedback.
-
Perhaps off-topic here, but was caused by a recent classloading change: |
Beta Was this translation helpful? Give feedback.
-
I was looking at https://github.com/quarkusio/quarkus/blob/5a2cb66525dc197b2c71ba8bf72eef4e298ef370/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/SerializedApplication.java and:
The reason for 2 is because many database (e.g. levelDB) has moved away from it for good reasons:
In short; we should think about the use case (now and in the future) where we expect it to be beneficial, before designing things around its strenghts and getting bitten (when it's too late) by its pain points. |
Beta Was this translation helpful? Give feedback.
-
@dmlloyd Just for fun I've tried this -> https://github.com/franz1981/quarkus/tree/shared_dir_names
have some common forms (as expected):
For example, in a normal non-crud quarkus APP we have 962 full dir names and 2959 sub-dirs from them - which is ~3 * full dirs. It seems, doing some basic math, that I'm getting a saving of 30-40% with this vs original behaviour, in the old generation (since these maps usually fall there) - said that, it's not bad. |
Beta Was this translation helpful? Give feedback.
-
We can reasonably split phases 2-4 on parallel tracks:
Tackling the generated images first seems like an achievable goal. There are definitely things to discuss around artifact resolution (and categorization) that directly pertain to class loading and isolation, but we should be able to produce at least a POC of a modular generated image to see what blows up, if we're not afraid to hard-code a few things. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Greetings fellow Quarkoids!
I'd like to propose the formation of a working group in order to address some long-standing class loading architectural issues within Quarkus.
Current Context and Problem Statement
At the time of this writing, the Quarkus codebase contains between 15 and 20 class loader implementations. These implementations serve a variety of purposes:
Each of these class loaders has a different behavior; some are outright incorrect. Additionally, we have a number of problems relating to specific implementations. These problems cover such areas as concurrency, virtual threads, delegation problems, and more.
The ad-hoc approach to class loading served us to get the Quarkus project off the ground quickly. However, at this stage of project evolution, I think it would be a good idea to take a top-down look at what our class loading needs are, and reevaluate the architecture. I think it would be particularly wise to consider the past (what did or did not work well for WildFly), the present (what does or does not work well in our existing implementations, what are GraalVM's needs), and the future (supporting JPMS, FFM, Leyden, and other future considerations).
Proposal
I'd propose we approach this in phases. The first phase (which is already underway) would involve reducing the surface area of the problem by looking through the various existing class loader implementations and cleaning them up, documenting them, and/or removing them from the code base if they are no longer needed. See #43726 for a top-level issue covering this work.
The second phase would be a top-down analysis of how class loading should ideally work at both build and run time. This is where a more formal working group would be of most use. In this phase, we would consider what performance and behavioral characteristics are expected at both build time and run time.
A non-exhaustive list of things to consider:
The third phase would involve prototyping some kind of centralized class loading system which would be adaptable to all of the applicable scenarios above.
The final phase would be integration of the new class loading system and reorganization of the existing code around it.
Expected outcome
The expectation would be that a variety of problems which relate to class loading would be solved, and that future improvements (particularly those relating to JDK restrictions around FFM integration, reflection, and serialization, as well as JDK improvements such as the Project Leyden efforts) would be more possible and/or simpler compared to today.
There is also an expectation that class loading performance would be on par with today, if not better.
As a knock-on benefit, whether or not JPMS support is included, we should be able to provide users with more useful stack traces which include artifact IDs and versions for dependencies.
Related issues (non-exhaustive)
*JarRequiredBuildItem
#44518ResourceUtils
public smallrye/smallrye-common#372Beta Was this translation helpful? Give feedback.
All reactions