More Related Content Similar to Cloud Native Java GraalVM 이상과 현실 (20) Cloud Native Java GraalVM 이상과 현실40. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Community Edition
• Free
• Unsupported
• Runs all GraalVM languages
– Java (+Scala), JavaScript, Python, Ruby, R
• Support for native libraries in context of those languages too
– Tools (debugger, profiler, monitor agent)
• Basic version of SubstrateVM
– Native code has full access to address space
• Runs code in JVM, Node.js, MySQL, or standalone
Enterprise Edition
• Not Free
• Supported
• Best performance & size
– Graal EE Java is 20% faster than CE (on average)
– Dynamic languages (JS, Python, R, Ruby) 2x faster
– Smallest footprint – 2x smaller vs CE
• Native code memory protection
• Debugging tools for embedded use
Confidential – Oracle Internal/Restricted/Highly Restricted 40
GraalVM 라이센스
67. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Java에서 다른 언어 호출
Confidential – Oracle Internal/Restricted/Highly Restricted 67
import org.graalvm.polyglot.*;
public class Sample {
public static void main(String[] args) {
try (Context context = Context.newBuilder().allowAllAccess(true).build()){
System.out.println( context.getEngine().getLanguages().keySet());
context.eval("ruby", "puts '안녕, 루비’”);
context.eval("python", "print(안녕, 파이썬')");
context.eval("js", "console.log(‘안녕, JS')");
context.eval("R", "cat(‘안녕, R')");
} catch (PolyglotException e) {
e.printStackTrace();
}
}
}
https://github.com/taewanme/graalvm_seminar_examples/tree/master/examples/e04
71. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Java에서 다른 언어를 호출 (LLVM)
Confidential – Oracle Internal/Restricted/Highly Restricted 71
import org.graalvm.polyglot.*;
import java.io.*;
public class Sample {
public static void main(String[] args) throws Exception {
File f = new File("hello.bc");
Source source = Source.newBuilder("llvm", new File("hello.bc")).build();
try (Context context = Context.newBuilder().allowAllAccess(true).build()){
context.eval(source).execute();
}
}
}
https://github.com/taewanme/graalvm_seminar_examples/tree/master/examples/e03