-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Reevaluate the impact of requiring metadata entries for each class member query #7753
Comments
Impact of adding all classes, methods and constructors (no fields) from registered classes as queried (not invoked): Micronaut shopcart:
Spring petclinic:
The startup time may have been affected by some methods added as reachable to enable running the benchmark with the additional configuration. Evaluation of the impact on configuration file entries will follow soon. Evaluating the impact of including all elements as invoked/accessed will take more time, if it is at all possible, since the analysis and program behaviour will be affected in more drastic ways. |
Impact on configuration file size (1 entry = 1 class, field, method, or "queryAllMethods"-style field): Micronaut shopcart:
Spring petclinic:
|
Hi @loicottet, what's needed to get some Quarkus project(s) included in the evaluation? I am willing to perform the runs and report the numbers if needed. |
We can do that as well, @loicottet can you share the code when ready on a PR and notify us here? The reason we did not evaluate Quarkus is simply because Quarkus uses almost no reflection. We have the tika benchmark in our set of benchmarks, so we should report that here as well. |
I would expect micronaut and quarkus would be similar in amount of reflections ? But okay now I see the comments about what it impacts then I better understand it and Afaics confirms my thinking. That the measurement here will be greatly affected by what libraries/extensions are involved in the testing. If I grok it right - this new change will make it so where before you had to explicitly list defsult constructors and other parts graalvm would now default include it even though it might not be strictly required and thus cost extra in image size. That means you will get quite different results dependent on what kind library's are involved. The more default constructors present or just mere number of classes the bigger impact it will have. Right? Thus if looking at quarkus apps if you take something like pet clinic which dependencies include java driver, hibernate and a few other things you would find that in quarkus superheroes villain or quarkus todo app too (is my assumption) But if you take a quarkus app that uses the Kubernetes client at runtime (not just buildtime) which has a huge model class api I would expect quite the different level of impact/measurements. |
We measured a long time ago and it was almost 0. We will confirm when the results come in.
We will likely expand the evaluation to the whole metadata repo to cover the different use cases you mention. Of course, if you have some interesting projects, we will gladly include them in the set of benchmarks. |
The latest results follow: All values are normalized to the current configuration. The The Quarkus numbers are not included as the benchmark was not executable in our CI at the time this experiment was executed. The Spring Boot benchmark for |
TL;DR
The current reflection in Native Image requires metadata entries for each query on
java.lang.Class
instances. For example, callingclazz.getDeclaredMethods()
will require a JSON entry"allDeclaredMethods": true"
for that class. This fine-grained approach can be cumbersome as it yields many entries in reflection metadata.We will investigate the impact of including metadata of all
java.lang.Class
members for classes registered for reflection. This would include names and signatures of all methods, properties of all fields, and all annotations.The impact will be evaluated on, Spring Petclinic, Micronaut Shopcart, and a few prominent metadata-repository projects. The following metrics will be taken into account: Max RSS, Startup time, Image Size, and the number of required metadata entries.
Goals
Non-goals
The text was updated successfully, but these errors were encountered: