SlideShare ist ein Scribd-Unternehmen logo
1 von 40
Downloaden Sie, um offline zu lesen
Micronaut + GraalVM = <3
Iván López
(@ilopmar)
Iván López @ilopmar
Iván López (@ilopmar)
Iván López @ilopmar
- Universal Polyglot VM de Oracle
- Lenguajes de la JVM + Ruby, Python, JS, R
- Graal Compiler / JVMCI
- Truffle
- Substrate VM
GraalVM
Iván López @ilopmar
- Reflection (con configuración)
- Dynamic class loading (con configuración)
- Dynamic proxy (con configuración)
- Unsafe Memory Access (parcialmente)
- Class initializers (soportado)
- InvokeDynamic bytecode y method handlers (parcialmente)
- Lambda (soportado)
- Finalizers (no soportado)
- Threads (parcialmente)
Limitaciones
Iván López @ilopmar
- Framework para microservicios en la JVM
- Ultra-ligero & reactive (basado en Netty)
- Java, Groovy & Kotlin
- Ahead of Time compilation (AoT)
- Sin reflection ni runtime proxies
- Arranque muy rápido
- Consumo de memoria bajo
- Natively Cloud Native
- Micronaut Data
- Soporte para GraalVM (mejorado en Micronaut 2.0)
Micronaut
Iván López @ilopmar
$ mn create-app basic-app
--features=graalvm
Crear aplicación con soporte para GraalVM
Iván López @ilopmar
$ mn create-app basic-app
--features=graalvm
Crear aplicación con soporte para GraalVM
Micronaut 2.1 & Gradle
Iván López @ilopmar
$ ./gradlew nativeImage
Crear native image
$ ./gradlew dockerBuildNative
Iván López @ilopmar
- Composable native-image.properties
¿Cómo funciona?
Iván López @ilopmar
# inject/native-image.properties
Args = --allow-incomplete-classpath 
-H:EnableURLProtocols=http,https
# http/native-image.properties
Args = -H:IncludeResources=META-INF/http/mime.types
# http-netty/native-image.properties
Args = --initialize-at-run-time=
com.sun.jndi.dns.DnsClient,io.netty.handler.ssl.ConscryptAlpnSslEngine,io.netty.handler.ssl.Je
ttyNpnSslEngine,io.netty.handler.ssl.ReferenceCountedOpenSslEngine,io.netty.handler.ssl.JdkNpn
ApplicationProtocolNegotiator,io.netty.handler.ssl.ReferenceCountedOpenSslServerContext,io.net
ty.handler.ssl.ReferenceCountedOpenSslClientContext,io.netty.handler.ssl.util.BouncyCastleSelf
SignedCertGenerator,io.netty.handler.ssl.ReferenceCountedOpenSslContext,io.micronaut.buffer.ne
tty.NettyByteBufferFactory,io.netty.handler.ssl.JettyAlpnSslEngine$ClientEngine,io.netty.handl
er.ssl.JettyAlpnSslEngine$ServerEngine,io.netty.handler.codec.http2.Http2CodecUtil,io.netty.ha
ndler.codec.http2.CleartextHttp2ServerUpgradeHandler,io.netty.handler.codec.http2.Http2ServerU
pgradeCodec,io.micronaut.http.netty.channel.converters.EpollChannelOptionFactory,io.micronaut.
http.netty.channel.converters.KQueueChannelOptionFactory,io.micronaut.http.bind.binders.Contin
uationArgumentBinder$Companion,io.micronaut.http.bind.binders.ContinuationArgumentBinder
Micronaut incluye todo lo necesario (I)
Iván López @ilopmar
@AutomaticFeature
final class HibernateFeature implements Feature {
@Override
public void beforeAnalysis(BeforeAnalysisAccess access) {
// other drivers...
registerIfPresent(access, "oracle.jdbc.OracleDriver",
Oracle8iDialect.class,
Oracle9iDialect.class,
Oracle10gDialect.class,
Oracle12cDialect.class);
}
}
Micronaut incluye todo lo necesario (II)
Iván López @ilopmar
private void handleOracle(BeforeAnalysisAccess access) {
Class<?> oracleDriver = access.findClassByName(ORACLE_DRIVER);
if (oracleDriver != null) {
registerAllIfPresent(access, "oracle.jdbc.driver.T4CDriverExtension");
registerAllIfPresent(access, "oracle.jdbc.driver.T2CDriverExtension");
registerAllIfPresent(access, "oracle.net.ano.Ano");
registerAllIfPresent(access, "oracle.net.ano.AuthenticationService");
registerAllIfPresent(access, "oracle.net.ano.DataIntegrityService");
registerAllIfPresent(access, "oracle.net.ano.EncryptionService");
registerAllIfPresent(access, "oracle.net.ano.SupervisorService");
ResourcesRegistry resourcesRegistry = getResourceRegistry();
if (resourcesRegistry != null) {
resourcesRegistry.addResources("META-INF/services/java.sql.Driver");
resourcesRegistry.addResources("oracle/sql/converter_xcharset/lx20002.glb");
resourcesRegistry.addResources("oracle/sql/converter_xcharset/lx2001f.glb");
resourcesRegistry.addResources("oracle/sql/converter_xcharset/lx200b2.glb");
resourcesRegistry.addResourceBundles("oracle.net.jdbc.nl.mesg.NLSR");
resourcesRegistry.addResourceBundles("oracle.net.mesg.Message");
}
initializeAtBuildTime(access,
"oracle.net.jdbc.nl.mesg.NLSR_en",
"oracle.jdbc.driver.DynamicByteArray",
"oracle.sql.ConverterArchive",
"oracle.sql.converter.CharacterConverterJDBC",
"oracle.sql.converter.CharacterConverter1Byte"
);
initializeAtRuntime(access, "java.sql.DriverManager");
}
}
Micronaut incluye todo lo necesario (III)
Iván López @ilopmar
Micronaut incluye todo lo necesario (IV)
Iván López @ilopmar
Micronaut incluye todo lo necesario (V)
Iván López @ilopmar
- @Introspected
- @TypeHint
- @ReflectiveAccess
- GraalTypeElementVisitor
-reflection-config.json
-resource-config.json (* Micronaut 2.0)
Soporte en Micronaut
DEMO
Iván López @ilopmar
Demo
Iván López @ilopmar
11 vs 134 MB
¿Y la memoria?
Iván López @ilopmar
- Crear una imagen nativa tarda mucho
- Y necesita mucha RAM
- GraalVM cambia muy rápido (y a veces rompen cosas)...
- ...y nosotros también ;-)
- Usabamos Travis para Micronaut (ahora Github Actions), pero...
- ...Travis tiene límite para la RAM
- Necesitábamos otra opción.
Y esto… ¿Cómo se testea?
Iván López @ilopmar
- Jobs periódicos cada hora (2.1.x / 2.0.x)
- Sólo si nuevos commit en Micronaut o GraalVM
- Compila GraalVM desde el código fuente (JDK8 & JDK 11)
- Crea imágenes nativas de aplicaciones de prueba de Micronaut
- Ejecuta tests funcionales
- https://github.com/micronaut-graal-tests
- https://gitlab.com/micronaut-projects/micronaut-graal-tests
Tests usando Gitlab CI
Iván López @ilopmar
- Basic application: DI, serialización de POJO, tipos reactivos,
HTTP Client
- Cache
- Micronaut function
- Service discovery: Consul & Eureka
- Static resources & views: Handlebars, Thymeleaf, Freemarker y Velocity
- Endpoints de Management & Metrics
- Distributed tracing: Zipkin
- RabbitMQ: Fire-and-forget & RPC
Aplicaciones de prueba Micronaut-GraalVM
Iván López @ilopmar
- Security: JWT, Basic Auth, Cookie, Session
- Scheduled jobs
- Micronaut Data JDBC: H2, Postgresql, Oracle, MariaDB, MS SQL Server
- Micronaut Data JPA-Hibernate: H2, Postgresql, MariaDB
- Bean Introspection
- Servlet: Tomcat & Jetty
- Flyway
- AWS app & function
- gRPC
Aplicaciones de prueba Micronaut-GraalVM
Iván López @ilopmar
Gitlab CI
Iván López @ilopmar
Gitlab CI
Iván López @ilopmar
Gitlab CI
Iván López @ilopmar
Gitlab CI
Iván López @ilopmar
Gitlab CI
Iván López @ilopmar
Gitlab CI
Iván López @ilopmar
Gitlab CI
Iván López @ilopmar
Gitlab CI
Iván López @ilopmar
Gitlab CI hace 20 meses
Iván López @ilopmar
x4
- JDK 8 & 11
- 2.1.x & 2.0.x
Gitlab CI hoy
Iván López @ilopmar
Runners propios en AWS
Iván López @ilopmar
Casos de uso
Iván López @ilopmar
- https://launch.micronaut.io (Google Cloud)
- Micronaut CLI: Linux, MacOS, Windows
- AWS Lambda + Custom runtime
Casos de uso
Iván López @ilopmar
GraalVM es una tecnología
nueva e interesante
Cuidado con las
limitaciones y casos de uso
Soporte out-of-the-box
en Micronaut
Mejoras en cada release Arranque más rápido &
menos consumo de
memoria
Desarrolladores
contentos y productivos
Resumen
¡Gracias!
@ilopmar
lopez.ivan@gmail.com
https://github.com/ilopmar
Iván López
https://bit.ly/jconf-mx-micronaut
¿Preguntas?

Weitere ähnliche Inhalte

Ähnlich wie JConf México 2020 - Micronaut + GraalVM = <3

Replicacion de Base de datos con OGG
Replicacion de Base de datos con OGGReplicacion de Base de datos con OGG
Replicacion de Base de datos con OGGErick Vidbaz
 
Javier Saez - Una panorámica sobre la seguridad en entornos web [rootedvlc2]
Javier Saez - Una panorámica sobre la seguridad en entornos web [rootedvlc2]Javier Saez - Una panorámica sobre la seguridad en entornos web [rootedvlc2]
Javier Saez - Una panorámica sobre la seguridad en entornos web [rootedvlc2]RootedCON
 
JConf Perú 2020 - ¡Micronaut en acción!
JConf Perú 2020 - ¡Micronaut en acción!JConf Perú 2020 - ¡Micronaut en acción!
JConf Perú 2020 - ¡Micronaut en acción!Iván López Martín
 
Codemotion Madrid 2020 - Serverless con Micronaut
Codemotion Madrid 2020 - Serverless con MicronautCodemotion Madrid 2020 - Serverless con Micronaut
Codemotion Madrid 2020 - Serverless con MicronautIván López Martín
 
Presentacion Demo Open Solaris
Presentacion Demo Open SolarisPresentacion Demo Open Solaris
Presentacion Demo Open Solarisguest926912
 
Why Apache Flink is better than Spark by Rubén Casado
Why Apache Flink is better than Spark by Rubén CasadoWhy Apache Flink is better than Spark by Rubén Casado
Why Apache Flink is better than Spark by Rubén CasadoBig Data Spain
 
Oracle Coherence (by Leonardo Torres Altez)
Oracle Coherence (by Leonardo Torres Altez)Oracle Coherence (by Leonardo Torres Altez)
Oracle Coherence (by Leonardo Torres Altez)barcelonajug
 
Jvmmx docker jvm
Jvmmx docker jvmJvmmx docker jvm
Jvmmx docker jvmsuperserch
 
Un poco más allá con grails. PrimerViernes
Un poco más allá con grails. PrimerViernesUn poco más allá con grails. PrimerViernes
Un poco más allá con grails. PrimerViernesDani Latorre
 
Analitica y toma de decisiones en tiempo real sobre plataformas big data
Analitica y toma de decisiones en tiempo real sobre plataformas big dataAnalitica y toma de decisiones en tiempo real sobre plataformas big data
Analitica y toma de decisiones en tiempo real sobre plataformas big dataJosé Carlos García Serrano
 
Oracle RAC sin sorpresas - v2014
Oracle RAC sin sorpresas - v2014Oracle RAC sin sorpresas - v2014
Oracle RAC sin sorpresas - v2014Nelson Calero
 
Jesús Olmos - ChromeHack, a html5/chrome webhack tool [Rooted CON 2013]
Jesús Olmos - ChromeHack, a html5/chrome webhack tool [Rooted CON 2013]Jesús Olmos - ChromeHack, a html5/chrome webhack tool [Rooted CON 2013]
Jesús Olmos - ChromeHack, a html5/chrome webhack tool [Rooted CON 2013]RootedCON
 
Multi relay
Multi relayMulti relay
Multi relayjselvi
 
José Selvi - Unprivileged Network Post-Exploitation [RootedCON 2011]
José Selvi - Unprivileged Network Post-Exploitation [RootedCON 2011]José Selvi - Unprivileged Network Post-Exploitation [RootedCON 2011]
José Selvi - Unprivileged Network Post-Exploitation [RootedCON 2011]RootedCON
 
MySQL Team – Open Day Oracle 2013
MySQL Team – Open Day Oracle 2013MySQL Team – Open Day Oracle 2013
MySQL Team – Open Day Oracle 2013Erik Gur
 

Ähnlich wie JConf México 2020 - Micronaut + GraalVM = <3 (20)

Replicacion de Base de datos con OGG
Replicacion de Base de datos con OGGReplicacion de Base de datos con OGG
Replicacion de Base de datos con OGG
 
Javier Saez - Una panorámica sobre la seguridad en entornos web [rootedvlc2]
Javier Saez - Una panorámica sobre la seguridad en entornos web [rootedvlc2]Javier Saez - Una panorámica sobre la seguridad en entornos web [rootedvlc2]
Javier Saez - Una panorámica sobre la seguridad en entornos web [rootedvlc2]
 
JRuby al Rescate de J2EE
JRuby al Rescate de J2EEJRuby al Rescate de J2EE
JRuby al Rescate de J2EE
 
JConf Perú 2020 - ¡Micronaut en acción!
JConf Perú 2020 - ¡Micronaut en acción!JConf Perú 2020 - ¡Micronaut en acción!
JConf Perú 2020 - ¡Micronaut en acción!
 
Codemotion Madrid 2020 - Serverless con Micronaut
Codemotion Madrid 2020 - Serverless con MicronautCodemotion Madrid 2020 - Serverless con Micronaut
Codemotion Madrid 2020 - Serverless con Micronaut
 
Presentacion Demo Open Solaris
Presentacion Demo Open SolarisPresentacion Demo Open Solaris
Presentacion Demo Open Solaris
 
Why Apache Flink is better than Spark by Rubén Casado
Why Apache Flink is better than Spark by Rubén CasadoWhy Apache Flink is better than Spark by Rubén Casado
Why Apache Flink is better than Spark by Rubén Casado
 
Oracle Coherence (by Leonardo Torres Altez)
Oracle Coherence (by Leonardo Torres Altez)Oracle Coherence (by Leonardo Torres Altez)
Oracle Coherence (by Leonardo Torres Altez)
 
Jvmmx docker jvm
Jvmmx docker jvmJvmmx docker jvm
Jvmmx docker jvm
 
Un poco más allá con grails. PrimerViernes
Un poco más allá con grails. PrimerViernesUn poco más allá con grails. PrimerViernes
Un poco más allá con grails. PrimerViernes
 
Analitica y toma de decisiones en tiempo real sobre plataformas big data
Analitica y toma de decisiones en tiempo real sobre plataformas big dataAnalitica y toma de decisiones en tiempo real sobre plataformas big data
Analitica y toma de decisiones en tiempo real sobre plataformas big data
 
JRuby Al Rescate J2EE
JRuby Al Rescate J2EEJRuby Al Rescate J2EE
JRuby Al Rescate J2EE
 
Mitos y realidades de la seguridad en Java
Mitos y realidades de la seguridad en JavaMitos y realidades de la seguridad en Java
Mitos y realidades de la seguridad en Java
 
Oracle RAC sin sorpresas - v2014
Oracle RAC sin sorpresas - v2014Oracle RAC sin sorpresas - v2014
Oracle RAC sin sorpresas - v2014
 
Docker y PostgreSQL
Docker y PostgreSQLDocker y PostgreSQL
Docker y PostgreSQL
 
Jesús Olmos - ChromeHack, a html5/chrome webhack tool [Rooted CON 2013]
Jesús Olmos - ChromeHack, a html5/chrome webhack tool [Rooted CON 2013]Jesús Olmos - ChromeHack, a html5/chrome webhack tool [Rooted CON 2013]
Jesús Olmos - ChromeHack, a html5/chrome webhack tool [Rooted CON 2013]
 
Multi relay
Multi relayMulti relay
Multi relay
 
José Selvi - Unprivileged Network Post-Exploitation [RootedCON 2011]
José Selvi - Unprivileged Network Post-Exploitation [RootedCON 2011]José Selvi - Unprivileged Network Post-Exploitation [RootedCON 2011]
José Selvi - Unprivileged Network Post-Exploitation [RootedCON 2011]
 
MySQL Team – Open Day Oracle 2013
MySQL Team – Open Day Oracle 2013MySQL Team – Open Day Oracle 2013
MySQL Team – Open Day Oracle 2013
 
Monitorización En OpenSolaris
Monitorización En OpenSolarisMonitorización En OpenSolaris
Monitorización En OpenSolaris
 

Mehr von Iván López Martín

SalmorejoTech 2024 - Spring Boot <3 Testcontainers
SalmorejoTech 2024 - Spring Boot <3 TestcontainersSalmorejoTech 2024 - Spring Boot <3 Testcontainers
SalmorejoTech 2024 - Spring Boot <3 TestcontainersIván López Martín
 
CommitConf 2024 - Spring Boot <3 Testcontainers
CommitConf 2024 - Spring Boot <3 TestcontainersCommitConf 2024 - Spring Boot <3 Testcontainers
CommitConf 2024 - Spring Boot <3 TestcontainersIván López Martín
 
Voxxed Days CERN 2024 - Spring Boot <3 Testcontainers.pdf
Voxxed Days CERN 2024 - Spring Boot <3 Testcontainers.pdfVoxxed Days CERN 2024 - Spring Boot <3 Testcontainers.pdf
Voxxed Days CERN 2024 - Spring Boot <3 Testcontainers.pdfIván López Martín
 
VMware - Testcontainers y Spring Boot
VMware - Testcontainers y Spring BootVMware - Testcontainers y Spring Boot
VMware - Testcontainers y Spring BootIván López Martín
 
Spring IO 2023 - Dynamic OpenAPIs with Spring Cloud Gateway
Spring IO 2023 - Dynamic OpenAPIs with Spring Cloud GatewaySpring IO 2023 - Dynamic OpenAPIs with Spring Cloud Gateway
Spring IO 2023 - Dynamic OpenAPIs with Spring Cloud GatewayIván López Martín
 
Codemotion Madrid 2023 - Testcontainers y Spring Boot
Codemotion Madrid 2023 - Testcontainers y Spring BootCodemotion Madrid 2023 - Testcontainers y Spring Boot
Codemotion Madrid 2023 - Testcontainers y Spring BootIván López Martín
 
CommitConf 2023 - Spring Framework 6 y Spring Boot 3
CommitConf 2023 - Spring Framework 6 y Spring Boot 3CommitConf 2023 - Spring Framework 6 y Spring Boot 3
CommitConf 2023 - Spring Framework 6 y Spring Boot 3Iván López Martín
 
Construyendo un API REST con Spring Boot y GraalVM
Construyendo un API REST con Spring Boot y GraalVMConstruyendo un API REST con Spring Boot y GraalVM
Construyendo un API REST con Spring Boot y GraalVMIván López Martín
 
jLove 2020 - Micronaut and graalvm: The power of AoT
jLove 2020 - Micronaut and graalvm: The power of AoTjLove 2020 - Micronaut and graalvm: The power of AoT
jLove 2020 - Micronaut and graalvm: The power of AoTIván López Martín
 
JConf Perú 2020 - Micronaut + GraalVM = <3
JConf Perú 2020 - Micronaut + GraalVM = <3JConf Perú 2020 - Micronaut + GraalVM = <3
JConf Perú 2020 - Micronaut + GraalVM = <3Iván López Martín
 
Developing Micronaut Applications With IntelliJ IDEA
Developing Micronaut Applications With IntelliJ IDEADeveloping Micronaut Applications With IntelliJ IDEA
Developing Micronaut Applications With IntelliJ IDEAIván López Martín
 
Greach 2019 - Creating Micronaut Configurations
Greach 2019 - Creating Micronaut ConfigurationsGreach 2019 - Creating Micronaut Configurations
Greach 2019 - Creating Micronaut ConfigurationsIván López Martín
 
VoxxedDays Bucharest 2019 - Alexa, nice to meet you
VoxxedDays Bucharest 2019 - Alexa, nice to meet youVoxxedDays Bucharest 2019 - Alexa, nice to meet you
VoxxedDays Bucharest 2019 - Alexa, nice to meet youIván López Martín
 
JavaDay Lviv 2019 - Micronaut in action!
JavaDay Lviv 2019 - Micronaut in action!JavaDay Lviv 2019 - Micronaut in action!
JavaDay Lviv 2019 - Micronaut in action!Iván López Martín
 
CrossDvlup Madrid 2019 - Alexa, encantado de conocerte
CrossDvlup Madrid 2019 - Alexa, encantado de conocerteCrossDvlup Madrid 2019 - Alexa, encantado de conocerte
CrossDvlup Madrid 2019 - Alexa, encantado de conocerteIván López Martín
 
Madrid-GUG - ¡Micronaut en acción!
Madrid-GUG - ¡Micronaut en acción!Madrid-GUG - ¡Micronaut en acción!
Madrid-GUG - ¡Micronaut en acción!Iván López Martín
 
Codemotion Madrid 2018 - Microservicios Reactivos con Micronaut
Codemotion Madrid 2018 - Microservicios Reactivos con MicronautCodemotion Madrid 2018 - Microservicios Reactivos con Micronaut
Codemotion Madrid 2018 - Microservicios Reactivos con MicronautIván López Martín
 
Commit Conf 2018 - Alexa, encantado de conocerte
Commit Conf 2018 - Alexa, encantado de conocerteCommit Conf 2018 - Alexa, encantado de conocerte
Commit Conf 2018 - Alexa, encantado de conocerteIván López Martín
 
Devoxx Belgium 2018 - Micronaut in Action!
Devoxx Belgium 2018 - Micronaut in Action!Devoxx Belgium 2018 - Micronaut in Action!
Devoxx Belgium 2018 - Micronaut in Action!Iván López Martín
 
Heisenbug 2018 - Test your Java applications with Spock
Heisenbug 2018 - Test your Java applications with SpockHeisenbug 2018 - Test your Java applications with Spock
Heisenbug 2018 - Test your Java applications with SpockIván López Martín
 

Mehr von Iván López Martín (20)

SalmorejoTech 2024 - Spring Boot <3 Testcontainers
SalmorejoTech 2024 - Spring Boot <3 TestcontainersSalmorejoTech 2024 - Spring Boot <3 Testcontainers
SalmorejoTech 2024 - Spring Boot <3 Testcontainers
 
CommitConf 2024 - Spring Boot <3 Testcontainers
CommitConf 2024 - Spring Boot <3 TestcontainersCommitConf 2024 - Spring Boot <3 Testcontainers
CommitConf 2024 - Spring Boot <3 Testcontainers
 
Voxxed Days CERN 2024 - Spring Boot <3 Testcontainers.pdf
Voxxed Days CERN 2024 - Spring Boot <3 Testcontainers.pdfVoxxed Days CERN 2024 - Spring Boot <3 Testcontainers.pdf
Voxxed Days CERN 2024 - Spring Boot <3 Testcontainers.pdf
 
VMware - Testcontainers y Spring Boot
VMware - Testcontainers y Spring BootVMware - Testcontainers y Spring Boot
VMware - Testcontainers y Spring Boot
 
Spring IO 2023 - Dynamic OpenAPIs with Spring Cloud Gateway
Spring IO 2023 - Dynamic OpenAPIs with Spring Cloud GatewaySpring IO 2023 - Dynamic OpenAPIs with Spring Cloud Gateway
Spring IO 2023 - Dynamic OpenAPIs with Spring Cloud Gateway
 
Codemotion Madrid 2023 - Testcontainers y Spring Boot
Codemotion Madrid 2023 - Testcontainers y Spring BootCodemotion Madrid 2023 - Testcontainers y Spring Boot
Codemotion Madrid 2023 - Testcontainers y Spring Boot
 
CommitConf 2023 - Spring Framework 6 y Spring Boot 3
CommitConf 2023 - Spring Framework 6 y Spring Boot 3CommitConf 2023 - Spring Framework 6 y Spring Boot 3
CommitConf 2023 - Spring Framework 6 y Spring Boot 3
 
Construyendo un API REST con Spring Boot y GraalVM
Construyendo un API REST con Spring Boot y GraalVMConstruyendo un API REST con Spring Boot y GraalVM
Construyendo un API REST con Spring Boot y GraalVM
 
jLove 2020 - Micronaut and graalvm: The power of AoT
jLove 2020 - Micronaut and graalvm: The power of AoTjLove 2020 - Micronaut and graalvm: The power of AoT
jLove 2020 - Micronaut and graalvm: The power of AoT
 
JConf Perú 2020 - Micronaut + GraalVM = <3
JConf Perú 2020 - Micronaut + GraalVM = <3JConf Perú 2020 - Micronaut + GraalVM = <3
JConf Perú 2020 - Micronaut + GraalVM = <3
 
Developing Micronaut Applications With IntelliJ IDEA
Developing Micronaut Applications With IntelliJ IDEADeveloping Micronaut Applications With IntelliJ IDEA
Developing Micronaut Applications With IntelliJ IDEA
 
Greach 2019 - Creating Micronaut Configurations
Greach 2019 - Creating Micronaut ConfigurationsGreach 2019 - Creating Micronaut Configurations
Greach 2019 - Creating Micronaut Configurations
 
VoxxedDays Bucharest 2019 - Alexa, nice to meet you
VoxxedDays Bucharest 2019 - Alexa, nice to meet youVoxxedDays Bucharest 2019 - Alexa, nice to meet you
VoxxedDays Bucharest 2019 - Alexa, nice to meet you
 
JavaDay Lviv 2019 - Micronaut in action!
JavaDay Lviv 2019 - Micronaut in action!JavaDay Lviv 2019 - Micronaut in action!
JavaDay Lviv 2019 - Micronaut in action!
 
CrossDvlup Madrid 2019 - Alexa, encantado de conocerte
CrossDvlup Madrid 2019 - Alexa, encantado de conocerteCrossDvlup Madrid 2019 - Alexa, encantado de conocerte
CrossDvlup Madrid 2019 - Alexa, encantado de conocerte
 
Madrid-GUG - ¡Micronaut en acción!
Madrid-GUG - ¡Micronaut en acción!Madrid-GUG - ¡Micronaut en acción!
Madrid-GUG - ¡Micronaut en acción!
 
Codemotion Madrid 2018 - Microservicios Reactivos con Micronaut
Codemotion Madrid 2018 - Microservicios Reactivos con MicronautCodemotion Madrid 2018 - Microservicios Reactivos con Micronaut
Codemotion Madrid 2018 - Microservicios Reactivos con Micronaut
 
Commit Conf 2018 - Alexa, encantado de conocerte
Commit Conf 2018 - Alexa, encantado de conocerteCommit Conf 2018 - Alexa, encantado de conocerte
Commit Conf 2018 - Alexa, encantado de conocerte
 
Devoxx Belgium 2018 - Micronaut in Action!
Devoxx Belgium 2018 - Micronaut in Action!Devoxx Belgium 2018 - Micronaut in Action!
Devoxx Belgium 2018 - Micronaut in Action!
 
Heisenbug 2018 - Test your Java applications with Spock
Heisenbug 2018 - Test your Java applications with SpockHeisenbug 2018 - Test your Java applications with Spock
Heisenbug 2018 - Test your Java applications with Spock
 

Kürzlich hochgeladen

EL CICLO PRÁCTICO DE UN MOTOR DE CUATRO TIEMPOS.pptx
EL CICLO PRÁCTICO DE UN MOTOR DE CUATRO TIEMPOS.pptxEL CICLO PRÁCTICO DE UN MOTOR DE CUATRO TIEMPOS.pptx
EL CICLO PRÁCTICO DE UN MOTOR DE CUATRO TIEMPOS.pptxMiguelAtencio10
 
Trabajo Mas Completo De Excel en clase tecnología
Trabajo Mas Completo De Excel en clase tecnologíaTrabajo Mas Completo De Excel en clase tecnología
Trabajo Mas Completo De Excel en clase tecnologíassuserf18419
 
Modulo-Mini Cargador.................pdf
Modulo-Mini Cargador.................pdfModulo-Mini Cargador.................pdf
Modulo-Mini Cargador.................pdfAnnimoUno1
 
Refrigerador_Inverter_Samsung_Curso_y_Manual_de_Servicio_Español.pdf
Refrigerador_Inverter_Samsung_Curso_y_Manual_de_Servicio_Español.pdfRefrigerador_Inverter_Samsung_Curso_y_Manual_de_Servicio_Español.pdf
Refrigerador_Inverter_Samsung_Curso_y_Manual_de_Servicio_Español.pdfvladimiroflores1
 
guía de registro de slideshare por Brayan Joseph
guía de registro de slideshare por Brayan Josephguía de registro de slideshare por Brayan Joseph
guía de registro de slideshare por Brayan JosephBRAYANJOSEPHPEREZGOM
 
Presentación guía sencilla en Microsoft Excel.pptx
Presentación guía sencilla en Microsoft Excel.pptxPresentación guía sencilla en Microsoft Excel.pptx
Presentación guía sencilla en Microsoft Excel.pptxLolaBunny11
 
Avances tecnológicos del siglo XXI 10-07 eyvana
Avances tecnológicos del siglo XXI 10-07 eyvanaAvances tecnológicos del siglo XXI 10-07 eyvana
Avances tecnológicos del siglo XXI 10-07 eyvanamcerpam
 
EPA-pdf resultado da prova presencial Uninove
EPA-pdf resultado da prova presencial UninoveEPA-pdf resultado da prova presencial Uninove
EPA-pdf resultado da prova presencial UninoveFagnerLisboa3
 
Avances tecnológicos del siglo XXI y ejemplos de estos
Avances tecnológicos del siglo XXI y ejemplos de estosAvances tecnológicos del siglo XXI y ejemplos de estos
Avances tecnológicos del siglo XXI y ejemplos de estossgonzalezp1
 
Desarrollo Web Moderno con Svelte 2024.pdf
Desarrollo Web Moderno con Svelte 2024.pdfDesarrollo Web Moderno con Svelte 2024.pdf
Desarrollo Web Moderno con Svelte 2024.pdfJulian Lamprea
 
Global Azure Lima 2024 - Integración de Datos con Microsoft Fabric
Global Azure Lima 2024 - Integración de Datos con Microsoft FabricGlobal Azure Lima 2024 - Integración de Datos con Microsoft Fabric
Global Azure Lima 2024 - Integración de Datos con Microsoft FabricKeyla Dolores Méndez
 
presentacion de PowerPoint de la fuente de poder.pptx
presentacion de PowerPoint de la fuente de poder.pptxpresentacion de PowerPoint de la fuente de poder.pptx
presentacion de PowerPoint de la fuente de poder.pptxlosdiosesmanzaneros
 
Presentación de elementos de afilado con esmeril
Presentación de elementos de afilado con esmerilPresentación de elementos de afilado con esmeril
Presentación de elementos de afilado con esmerilJuanGallardo438714
 
pruebas unitarias unitarias en java con JUNIT
pruebas unitarias unitarias en java con JUNITpruebas unitarias unitarias en java con JUNIT
pruebas unitarias unitarias en java con JUNITMaricarmen Sánchez Ruiz
 
PROYECTO FINAL. Tutorial para publicar en SlideShare.pptx
PROYECTO FINAL. Tutorial para publicar en SlideShare.pptxPROYECTO FINAL. Tutorial para publicar en SlideShare.pptx
PROYECTO FINAL. Tutorial para publicar en SlideShare.pptxAlan779941
 

Kürzlich hochgeladen (15)

EL CICLO PRÁCTICO DE UN MOTOR DE CUATRO TIEMPOS.pptx
EL CICLO PRÁCTICO DE UN MOTOR DE CUATRO TIEMPOS.pptxEL CICLO PRÁCTICO DE UN MOTOR DE CUATRO TIEMPOS.pptx
EL CICLO PRÁCTICO DE UN MOTOR DE CUATRO TIEMPOS.pptx
 
Trabajo Mas Completo De Excel en clase tecnología
Trabajo Mas Completo De Excel en clase tecnologíaTrabajo Mas Completo De Excel en clase tecnología
Trabajo Mas Completo De Excel en clase tecnología
 
Modulo-Mini Cargador.................pdf
Modulo-Mini Cargador.................pdfModulo-Mini Cargador.................pdf
Modulo-Mini Cargador.................pdf
 
Refrigerador_Inverter_Samsung_Curso_y_Manual_de_Servicio_Español.pdf
Refrigerador_Inverter_Samsung_Curso_y_Manual_de_Servicio_Español.pdfRefrigerador_Inverter_Samsung_Curso_y_Manual_de_Servicio_Español.pdf
Refrigerador_Inverter_Samsung_Curso_y_Manual_de_Servicio_Español.pdf
 
guía de registro de slideshare por Brayan Joseph
guía de registro de slideshare por Brayan Josephguía de registro de slideshare por Brayan Joseph
guía de registro de slideshare por Brayan Joseph
 
Presentación guía sencilla en Microsoft Excel.pptx
Presentación guía sencilla en Microsoft Excel.pptxPresentación guía sencilla en Microsoft Excel.pptx
Presentación guía sencilla en Microsoft Excel.pptx
 
Avances tecnológicos del siglo XXI 10-07 eyvana
Avances tecnológicos del siglo XXI 10-07 eyvanaAvances tecnológicos del siglo XXI 10-07 eyvana
Avances tecnológicos del siglo XXI 10-07 eyvana
 
EPA-pdf resultado da prova presencial Uninove
EPA-pdf resultado da prova presencial UninoveEPA-pdf resultado da prova presencial Uninove
EPA-pdf resultado da prova presencial Uninove
 
Avances tecnológicos del siglo XXI y ejemplos de estos
Avances tecnológicos del siglo XXI y ejemplos de estosAvances tecnológicos del siglo XXI y ejemplos de estos
Avances tecnológicos del siglo XXI y ejemplos de estos
 
Desarrollo Web Moderno con Svelte 2024.pdf
Desarrollo Web Moderno con Svelte 2024.pdfDesarrollo Web Moderno con Svelte 2024.pdf
Desarrollo Web Moderno con Svelte 2024.pdf
 
Global Azure Lima 2024 - Integración de Datos con Microsoft Fabric
Global Azure Lima 2024 - Integración de Datos con Microsoft FabricGlobal Azure Lima 2024 - Integración de Datos con Microsoft Fabric
Global Azure Lima 2024 - Integración de Datos con Microsoft Fabric
 
presentacion de PowerPoint de la fuente de poder.pptx
presentacion de PowerPoint de la fuente de poder.pptxpresentacion de PowerPoint de la fuente de poder.pptx
presentacion de PowerPoint de la fuente de poder.pptx
 
Presentación de elementos de afilado con esmeril
Presentación de elementos de afilado con esmerilPresentación de elementos de afilado con esmeril
Presentación de elementos de afilado con esmeril
 
pruebas unitarias unitarias en java con JUNIT
pruebas unitarias unitarias en java con JUNITpruebas unitarias unitarias en java con JUNIT
pruebas unitarias unitarias en java con JUNIT
 
PROYECTO FINAL. Tutorial para publicar en SlideShare.pptx
PROYECTO FINAL. Tutorial para publicar en SlideShare.pptxPROYECTO FINAL. Tutorial para publicar en SlideShare.pptx
PROYECTO FINAL. Tutorial para publicar en SlideShare.pptx
 

JConf México 2020 - Micronaut + GraalVM = <3

  • 1. Micronaut + GraalVM = <3 Iván López (@ilopmar)
  • 2. Iván López @ilopmar Iván López (@ilopmar)
  • 3.
  • 4. Iván López @ilopmar - Universal Polyglot VM de Oracle - Lenguajes de la JVM + Ruby, Python, JS, R - Graal Compiler / JVMCI - Truffle - Substrate VM GraalVM
  • 5. Iván López @ilopmar - Reflection (con configuración) - Dynamic class loading (con configuración) - Dynamic proxy (con configuración) - Unsafe Memory Access (parcialmente) - Class initializers (soportado) - InvokeDynamic bytecode y method handlers (parcialmente) - Lambda (soportado) - Finalizers (no soportado) - Threads (parcialmente) Limitaciones
  • 6.
  • 7. Iván López @ilopmar - Framework para microservicios en la JVM - Ultra-ligero & reactive (basado en Netty) - Java, Groovy & Kotlin - Ahead of Time compilation (AoT) - Sin reflection ni runtime proxies - Arranque muy rápido - Consumo de memoria bajo - Natively Cloud Native - Micronaut Data - Soporte para GraalVM (mejorado en Micronaut 2.0) Micronaut
  • 8. Iván López @ilopmar $ mn create-app basic-app --features=graalvm Crear aplicación con soporte para GraalVM
  • 9. Iván López @ilopmar $ mn create-app basic-app --features=graalvm Crear aplicación con soporte para GraalVM Micronaut 2.1 & Gradle
  • 10. Iván López @ilopmar $ ./gradlew nativeImage Crear native image $ ./gradlew dockerBuildNative
  • 11. Iván López @ilopmar - Composable native-image.properties ¿Cómo funciona?
  • 12. Iván López @ilopmar # inject/native-image.properties Args = --allow-incomplete-classpath -H:EnableURLProtocols=http,https # http/native-image.properties Args = -H:IncludeResources=META-INF/http/mime.types # http-netty/native-image.properties Args = --initialize-at-run-time= com.sun.jndi.dns.DnsClient,io.netty.handler.ssl.ConscryptAlpnSslEngine,io.netty.handler.ssl.Je ttyNpnSslEngine,io.netty.handler.ssl.ReferenceCountedOpenSslEngine,io.netty.handler.ssl.JdkNpn ApplicationProtocolNegotiator,io.netty.handler.ssl.ReferenceCountedOpenSslServerContext,io.net ty.handler.ssl.ReferenceCountedOpenSslClientContext,io.netty.handler.ssl.util.BouncyCastleSelf SignedCertGenerator,io.netty.handler.ssl.ReferenceCountedOpenSslContext,io.micronaut.buffer.ne tty.NettyByteBufferFactory,io.netty.handler.ssl.JettyAlpnSslEngine$ClientEngine,io.netty.handl er.ssl.JettyAlpnSslEngine$ServerEngine,io.netty.handler.codec.http2.Http2CodecUtil,io.netty.ha ndler.codec.http2.CleartextHttp2ServerUpgradeHandler,io.netty.handler.codec.http2.Http2ServerU pgradeCodec,io.micronaut.http.netty.channel.converters.EpollChannelOptionFactory,io.micronaut. http.netty.channel.converters.KQueueChannelOptionFactory,io.micronaut.http.bind.binders.Contin uationArgumentBinder$Companion,io.micronaut.http.bind.binders.ContinuationArgumentBinder Micronaut incluye todo lo necesario (I)
  • 13. Iván López @ilopmar @AutomaticFeature final class HibernateFeature implements Feature { @Override public void beforeAnalysis(BeforeAnalysisAccess access) { // other drivers... registerIfPresent(access, "oracle.jdbc.OracleDriver", Oracle8iDialect.class, Oracle9iDialect.class, Oracle10gDialect.class, Oracle12cDialect.class); } } Micronaut incluye todo lo necesario (II)
  • 14. Iván López @ilopmar private void handleOracle(BeforeAnalysisAccess access) { Class<?> oracleDriver = access.findClassByName(ORACLE_DRIVER); if (oracleDriver != null) { registerAllIfPresent(access, "oracle.jdbc.driver.T4CDriverExtension"); registerAllIfPresent(access, "oracle.jdbc.driver.T2CDriverExtension"); registerAllIfPresent(access, "oracle.net.ano.Ano"); registerAllIfPresent(access, "oracle.net.ano.AuthenticationService"); registerAllIfPresent(access, "oracle.net.ano.DataIntegrityService"); registerAllIfPresent(access, "oracle.net.ano.EncryptionService"); registerAllIfPresent(access, "oracle.net.ano.SupervisorService"); ResourcesRegistry resourcesRegistry = getResourceRegistry(); if (resourcesRegistry != null) { resourcesRegistry.addResources("META-INF/services/java.sql.Driver"); resourcesRegistry.addResources("oracle/sql/converter_xcharset/lx20002.glb"); resourcesRegistry.addResources("oracle/sql/converter_xcharset/lx2001f.glb"); resourcesRegistry.addResources("oracle/sql/converter_xcharset/lx200b2.glb"); resourcesRegistry.addResourceBundles("oracle.net.jdbc.nl.mesg.NLSR"); resourcesRegistry.addResourceBundles("oracle.net.mesg.Message"); } initializeAtBuildTime(access, "oracle.net.jdbc.nl.mesg.NLSR_en", "oracle.jdbc.driver.DynamicByteArray", "oracle.sql.ConverterArchive", "oracle.sql.converter.CharacterConverterJDBC", "oracle.sql.converter.CharacterConverter1Byte" ); initializeAtRuntime(access, "java.sql.DriverManager"); } } Micronaut incluye todo lo necesario (III)
  • 15. Iván López @ilopmar Micronaut incluye todo lo necesario (IV)
  • 16. Iván López @ilopmar Micronaut incluye todo lo necesario (V)
  • 17. Iván López @ilopmar - @Introspected - @TypeHint - @ReflectiveAccess - GraalTypeElementVisitor -reflection-config.json -resource-config.json (* Micronaut 2.0) Soporte en Micronaut
  • 18. DEMO
  • 20. Iván López @ilopmar 11 vs 134 MB ¿Y la memoria?
  • 21. Iván López @ilopmar - Crear una imagen nativa tarda mucho - Y necesita mucha RAM - GraalVM cambia muy rápido (y a veces rompen cosas)... - ...y nosotros también ;-) - Usabamos Travis para Micronaut (ahora Github Actions), pero... - ...Travis tiene límite para la RAM - Necesitábamos otra opción. Y esto… ¿Cómo se testea?
  • 22.
  • 23. Iván López @ilopmar - Jobs periódicos cada hora (2.1.x / 2.0.x) - Sólo si nuevos commit en Micronaut o GraalVM - Compila GraalVM desde el código fuente (JDK8 & JDK 11) - Crea imágenes nativas de aplicaciones de prueba de Micronaut - Ejecuta tests funcionales - https://github.com/micronaut-graal-tests - https://gitlab.com/micronaut-projects/micronaut-graal-tests Tests usando Gitlab CI
  • 24. Iván López @ilopmar - Basic application: DI, serialización de POJO, tipos reactivos, HTTP Client - Cache - Micronaut function - Service discovery: Consul & Eureka - Static resources & views: Handlebars, Thymeleaf, Freemarker y Velocity - Endpoints de Management & Metrics - Distributed tracing: Zipkin - RabbitMQ: Fire-and-forget & RPC Aplicaciones de prueba Micronaut-GraalVM
  • 25. Iván López @ilopmar - Security: JWT, Basic Auth, Cookie, Session - Scheduled jobs - Micronaut Data JDBC: H2, Postgresql, Oracle, MariaDB, MS SQL Server - Micronaut Data JPA-Hibernate: H2, Postgresql, MariaDB - Bean Introspection - Servlet: Tomcat & Jetty - Flyway - AWS app & function - gRPC Aplicaciones de prueba Micronaut-GraalVM
  • 34. Iván López @ilopmar Gitlab CI hace 20 meses
  • 35. Iván López @ilopmar x4 - JDK 8 & 11 - 2.1.x & 2.0.x Gitlab CI hoy
  • 38. Iván López @ilopmar - https://launch.micronaut.io (Google Cloud) - Micronaut CLI: Linux, MacOS, Windows - AWS Lambda + Custom runtime Casos de uso
  • 39. Iván López @ilopmar GraalVM es una tecnología nueva e interesante Cuidado con las limitaciones y casos de uso Soporte out-of-the-box en Micronaut Mejoras en cada release Arranque más rápido & menos consumo de memoria Desarrolladores contentos y productivos Resumen