O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.

96 visualizações

Publicada em

Java has a large number of tools and frameworks to facilitate integration with databases, microservices, and so on. These tools have evolved considerably. It all started with class integrated with XML files and has undergone significant evolution with reflections and annotations within the class definitions. In the cloud-native scenario, requirements have changed and this impacts applications in ways that weren't critical before. For example, cold starts and boot time wasn't critical with application servers but is crucial in serverless and microservices. The objective of this presentation is to talk about how these frameworks behave in the native cloud age and they affect Jakarta EE.

Publicada em: Tecnologia
  • Seja o primeiro a comentar

Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.

  1. 1. Otavio Santana @otaviojava Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends
  2. 2. Otavio Santana @otaviojava DevRel Engineer + Java Champion + JCP-EC-EG-EGL + Apache Committer + Eclipse Committer + Eclipse Project Leader + Book and blog writer Speaker
  3. 3. History
  4. 4. ● Mainframe ● Personal computer ● Multiple devices ● Cloud ● Services Information ages
  5. 5. ● Mainframe ● One Tier ● Three tiers ● Microservices Tiers ages
  6. 6. ● Year ● Monthly ● Daily ● Instantly (even on Friday) Deploy ages
  7. 7. Java
  8. 8. ● Cold start ● Serverless ● Memory What is wrong with Java?
  9. 9. ● Native ● Virtual VIP Threads
  10. 10. ● Spotify ● Twitter ● Netflix ● +64,000 Java shops
  11. 11. ● Cassandra ● Hadoop ● Apache Kafka ● Apache Lucene Big data
  12. 12. ● 80% of code Java frameworks
  13. 13. ● Mapper ● Pluggability Java frameworks
  14. 14. public class God { private String id; private String name; private Integer age; //getter and setter } <entity class="entity.God" name="God"> <table name="God"/> <attributes> <id name="id"/> <basic name="name"> <column name="NAME" length="100"/> </basic> <basic name="age"/> </attributes> </entity> We need to be more intuitive!! Metadata
  15. 15. ● Introspection ● Dynamic ● Several languages Reflection
  16. 16. ● Annotations ● Java 5 Tiger (2004-10-04) ● JSR 175 Metadata facility for Java @Entity public class God { @Id private String id; @Column private String name; @Column private Integer age; }
  17. 17. ● Runtime ● pluggability ● Dynamic ● Encapsulation Metadata facility for Java Class<Good> type = ...; Object value =...; Entity annotation = type.getAnnotation(Entity.class); Constructor<?>[] constructors = type.getConstructors(); T instance = (T) constructors[0].newInstance(); for (Field field : type.getDeclaredFields()) { field.setAccessible(true); field.set(instance, value); }
  18. 18. ● Runtime ● Cache ● ReflectionData Reflection issues //java.lang.Class ReflectionData<T> rd = reflectionData(); private static class ReflectionData<T> { }
  19. 19. ● PhantomReference ● WeakReference ● SoftReference ● StrongReference Reflection issues
  20. 20. ● We need more memory Reflection @Entity public class God { @Id private String id; @Column private String name; @Column private Integer age; } Framework Metadata Framework Metadata Framework Metadata
  21. 21. ● Java Compiler API Java 1.6 ● Nightmare start ● Dependencies ● JIT ● Start-up ~20x slower Reflection JavaSource<Entity> source = new JavaSource() { @Override public String getName() { return fullClassName; } @Override public String getJavaSource() { return source; } }; JavaFileObject fileObject = new JavaFileObject(...); compiler.getStandardFileManager(diagnosticCollector, ...);
  22. 22. ● We need cold start Reflection Compiler Issues @Entity public class God { @Id private String id; @Column private String name; }
  23. 23. ● Geoffrey De Smet @GeoffreyDeSmet ● Java Reflection, but Faster Fast Benchmark Score Error DirectAccess 2.590 ± 0.014 ns/op JavaCompiler 2.726 ± 0.026 5% slower Reflection 5.275 ± 0.053 104% slower MethodHandle 6.100 ± 0.079 136% slower * Units ns/op
  24. 24. ● Geoffrey De Smet @GeoffreyDeSmet ● Java Reflection, but Faster Bootstrap * Units ns/op Benchmark Score Error Reflection 268.510 ± 25.271 0.3µs/op MethodHandle 1519.177 ± 46.644 1.5µs/op JavaCompiler 4814526.314 ± 0.053 4814.5µs/op
  25. 25. ● JSR 269 ● Javac ● (AoT) JPE 295 Java 9 Java Annotation Processor @SupportedAnnotationTypes("org.soujava.medatadata.api.Entity") public class EntityProcessor extends AbstractProcessor { @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { //.... } }
  26. 26. ● Now, the compiler is the issue Java Annotation Processor @Entity public class God { @Id private String id; @Column private String name; } J A V A C
  27. 27. ● Pluggability ● Encapsulation ● Start-up ● Memory footprint Java Annotation Processor
  28. 28. ● Native ● Serverless ● GC ● JIT Native image Hardware ISA SO JVM App Hardware ISA SO App
  29. 29. ● Optimizations on GC ● Improvements Containers (OCI) ● Release 6 months ● Application Class-Data Sharing (JEP 310) Java
  30. 30. ● Which one should I choose? Metadata Plug Cold Warm Encapsulation Reflection Java Comp Annot. Proc. Native
  31. 31. ● Uncertain ● Container ● Modules ● Java Annotation Process ● Native ● Reflection Future
  32. 32. ● Startup ● JIT ● Memory ● Processor Performance
  33. 33. Platform.sh was built on the idea that your application comes first It’s what your customers care about. It’s what drives you and your team. We handle the rest.
  34. 34. Platform.sh provides an end-to-end PaaS to build, run, and maintain polyglot fleets of digital experience applications Developers can then focus on what matters to the organization: shipping great web apps and sites Container Orchestration Infrastructure Continuous Deployment Data Services App Runtimes Routing + Edge Security Continuous Integration Application Code Application Data Provisioning APIs, Integrations, Template Libraries Web Console … Source Operations™
  35. 35. Develop Git-native: instantly clone your code and infrastructure for every branch Services snap-in with a line of code—from MySQL to Kafka to Elasticsearch Build in virtually any runtime or framework Build CI/CD built in: run tests, compile dependencies Extensible with webhooks to integrate with any workflow Declarative infrastructure, versioned like your code Package Fully managed databases, queues, networking, storage Migrate between service versions with a single line of configuration Services patched and secured by Platform.sh Provision One-click deployment of new applications in an instant Custom template libraries API control over RBAC, app provisioning, deployment Deploy Apps and services are automatically containerized and deployed to our grid Supports stateful and stateless apps, worker processes Integrates with your current DevOps processes Run Production cloud hosting included Multicloud support: AWS, Microsoft Azure, Orange, Google, and regional partners Run without modifications between regions and clouds Manage Update your fleet with a single command Support everything from microservices to enterprise CMS to static sites Maintain governance over process, code, and infrastructure across distributed teams Secure All changes to code and infrastructure fully auditable SOC 2-certified Strict data localization available Integrated with Includes the best of Replaces Faster and far less costly than Works like We partner with Capabilities you won’t find with 24x7 data security and privacy Platform.sh is end-to-end
  36. 36. 1000s e-commerce, life sciences, government, education, media & entertainment, and high-tech customers $47m invested by top-tier international partners Platform.sh at a glance
  37. 37. Java
  38. 38. Q&A Thank you! Your contact: Otavio Santana DevRel Engineer, Platform.sh @otaviojava

×