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

[GR-53929] How to create and load SVM auxiliary image? #8767

Open
JiangWork opened this issue Apr 14, 2024 · 5 comments
Open

[GR-53929] How to create and load SVM auxiliary image? #8767

JiangWork opened this issue Apr 14, 2024 · 5 comments
Assignees

Comments

@JiangWork
Copy link

JiangWork commented Apr 14, 2024

Hi, All.

From the link , it says:

Oracle GraalVM supports persisting code data structures to disk. This enables to almost eliminate warmup time for the first run of an application in an isolate/process. The SVM auxiliary image feature is used to persist and load the necessary data structures to the disk. Persisting the image can take a significant amount of time as compilation needs to be performed. However, loading is designed to be as fast as possible, typically almost instantaneous.

This is exactly what i want, I want to load different the auxiliary images when creating different Isolates. I know we can put required data in image heap when building the image. But in my case, the data is large than 2GB and each isolate needs a small portion of the data. I found the API exists:
https://github.com/oracle/graal/blob/master/sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/Isolates.java#L124

  public Builder auxiliaryImagePath(String filePath) {
                this.auxiliaryImagePath = filePath;
                return this;
            }

If i persist the data into image heap, it will resulting following exception:

Caused by: java.lang.NegativeArraySizeException: -2091511808
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.RelocatableBuffer.<init>(RelocatableBuffer.java:56)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImage.build(NativeImage.java:465)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:708)
        ... 5 more

My question is, is there any guide to instruct me to create such auxiliary images and load them?

@selhagani
Copy link
Member

Hi @JiangWork, Thank you for reaching out to us!
Does this guide answer your need? https://www.graalvm.org/latest/graalvm-as-a-platform/language-implementation-framework/AuxiliaryEngineCachingEnterprise/

@JiangWork
Copy link
Author

JiangWork commented Apr 16, 2024

Hi, @selhagani Thanks for replying. I have already checked this doc. It uses JS framework, and underlying how to create the image is still black box. I am working on Java project.

@selhagani
Copy link
Member

selhagani commented Apr 24, 2024

Hi @JiangWork, This is an EE-only feature. Mind that the auxiliary images must be created at image runtime and are compatible only with the same primary native-image that they were created with.

@JiangWork
Copy link
Author

Thanks, @selhagani Where can i found the code?

@selhagani
Copy link
Member

Unfortunately, I'm unable to share the code with you as it's an EE-only feature. However, I understand the importance of this information for your needs. I'll make sure to relay your request to our team to develop documentation for this particular use case. Rest assured, I'll keep you informed about any updates regarding this matter.

@selhagani selhagani changed the title How to create and load SVM auxiliary image? [GR-53929] How to create and load SVM auxiliary image? May 6, 2024
@selhagani selhagani assigned peter-hofer and unassigned selhagani May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants