You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: app-dev/devops-and-containers/functions/java-helloworld-AI-with-local-dev-and-oci-functions/README.md
+32Lines changed: 32 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,6 +89,36 @@ June 13, 2024 is June 13, 1924. Here are some events that occurred on this date:
89
89
5. The German aerospace company Zeppelin began constructing the Hindenburg, a large passenger airship.
90
90
</pre>
91
91
92
+
# Native image using GraalVM
93
+
94
+
GraalVM compiles your Java functions ahead of time into standalone binaries that start instantly, provide peak performance with no warmup, and use fewer resources. The key GraalVM benefits are: Low Resource Usage: Java applications compiled ahead-of-time by GraalVM require less memory and CPU to run.
95
+
96
+
<p>
97
+
98
+
To do this a <ahref="./files/Dockerfile.native">Docker multi-stage build</a> is used. E.g.
The GraalVM compilation stage requires quite a bit resources from your localhost so in case for example using Rancher desktop
105
+
think of increasing the CPU and memory for it to make the build faster.
106
+
107
+
<p>
108
+
109
+
In the <ahref="./files/Dockerfile.native">Dockerfile.native</a> two things are important: Including the <ahref="./files/reflection.json">reflection.json</a> with the proper function class name and passing <code>"-Djava.library.path=/lib"</code> in the container CMD along with the <code>"com.example.HelloAIFunction::handleRequest"</code> function handler.
Finally deploy the container to your OCI Function by replacing the container using the Cloud UI by editing the function and changing the container from <code>helloworldai-java:1</code> to <code>helloworldai-java:2</code>. Then test it.
@@ -99,6 +129,8 @@ June 13, 2024 is June 13, 1924. Here are some events that occurred on this date:
99
129
- The Fn project is an open-source container-native serverless platform that you can run anywhere -- any cloud or on-premise. It’s easy to use, supports every programming language, and is extensible and performant
- Discover the power of generative AI models equipped with advanced language comprehension for building the next generation of enterprise applications. Oracle Cloud Infrastructure (OCI) Generative AI is a fully managed service for seamlessly integrating these versatile language models into a wide range of use cases, including writing assistance, summarization, analysis, and chat
132
+
-[OCI Functions with GraalVM](https://github.com/shaunsmith/graalvm-fn-init-images)
133
+
- Discover GraalVM Native Image -based functions with this example GitHub repo
0 commit comments