Se ha denunciado esta presentación.
Se está descargando tu SlideShare. ×

To the moon and beyond with Java 17 APIs! | DevNation Tech Talk

To the moon and beyond with Java 17 APIs! | DevNation Tech Talk

Descargar para leer sin conexión

Since moving to a 6 monthly release cadence, the Java platform is evolving more dynamically than ever before. It can be quite a challenge to stay on top of all the changes and new features. In this talk we're going to explore the most important developments in the Java API: which classes have been added, and what has been removed? Join Duke, the Java mascot, for a trip to space and learn which exciting new APIs provided by the Java platform can help him with his journey:

The Java Vector API for utilizing the SIMD capabilities of modern CPU architectures
The Foreign Linker API for integrating with native code
The JFR Event Streaming API for publishing JDK Flight Recorder Events
We'll also take a look at some useful changes to the Java runtime, such as CDS archives for a faster spaceship..., uhm, application launch!

Since moving to a 6 monthly release cadence, the Java platform is evolving more dynamically than ever before. It can be quite a challenge to stay on top of all the changes and new features. In this talk we're going to explore the most important developments in the Java API: which classes have been added, and what has been removed? Join Duke, the Java mascot, for a trip to space and learn which exciting new APIs provided by the Java platform can help him with his journey:

The Java Vector API for utilizing the SIMD capabilities of modern CPU architectures
The Foreign Linker API for integrating with native code
The JFR Event Streaming API for publishing JDK Flight Recorder Events
We'll also take a look at some useful changes to the Java runtime, such as CDS archives for a faster spaceship..., uhm, application launch!

Más Contenido Relacionado

Más de Red Hat Developers

Audiolibros relacionados

Gratis con una prueba de 30 días de Scribd

Ver todo

To the moon and beyond with Java 17 APIs! | DevNation Tech Talk

  1. 1. To the Moon and Beyond With Java 17 APIs! Gunnar Morling Software Engineer, Red Hat @gunnarmorling
  2. 2. #Java17APIs @gunnarmorling “Commit [ourselves] to achieving the goal, before this decade talk is out, of landing a man Duke on the Moon and returning him safely to the Earth” Today’s Mission John F. Kennedy
  3. 3. The Vector API 1 JFR Event Streaming 2 3 The Foreign Linker API
  4. 4. #Java17APIs @gunnarmorling ● Projects ○ Debezium ○ Quarkus ○ Hibernate ● MapStruct, JfrUnit, kcctl 🧸 ● Java Champion ● @gunnarmorling Gunnar Morling Open Source Software Engineer at Red Hat
  5. 5. The Vector API 1
  6. 6. #Java17APIs @gunnarmorling The Vector API JEPs 338 / 414 / 417 java.util.Vector?!
  7. 7. #Java17APIs @gunnarmorling “Introduce an API to express vector computations that reliably compile at runtime to optimal vector instructions on supported CPU architectures, thus achieving performance superior to equivalent scalar computations.” The Vector API JEPs 338 / 414 / 417 JEP 417
  8. 8. #Java17APIs @gunnarmorling The Vector API Goals Clear and concise API 1 Reliable runtime compilation and performance on x64 (SSE, AVX) and AArch64 (NEON, SVE) 2 3 4 Platform agnostic Graceful degradation
  9. 9. #Java17APIs @gunnarmorling The Vector API Use Cases ● Image, text, signal processing ● Encryption ● Machine Learning ● etc.
  10. 10. #Java17APIs @gunnarmorling The Vector API Terminology
  11. 11. #Java17APIs @gunnarmorling The Vector API Example – Scalar c = -(a2 + b2 )
  12. 12. #Java17APIs @gunnarmorling The Vector API Example – Vector
  13. 13. #Java17APIs @gunnarmorling The Vector API Example – Vector
  14. 14. #Java17APIs @gunnarmorling The Vector API Example – Vector
  15. 15. #Java17APIs @gunnarmorling The Vector API Example – Vector
  16. 16. #Java17APIs @gunnarmorling The Vector API Example – Vector
  17. 17. #Java17APIs @gunnarmorling The Vector API A Very Rich API
  18. 18. #Java17APIs @gunnarmorling The Vector API Example – FizzBuzz
  19. 19. #Java17APIs @gunnarmorling The Vector API FizzBuzz – Performance Benchmark Mode Cnt Score Error Units scalarFizzBuzz thrpt 5 2204774,792 ± 76581,374 ops/s simdFizzBuzz thrpt 5 8830433,250 ± 69955,161 ops/s MacBook Pro 2019 (2,6 GHz 6-Core Intel Core i7, 32GB RAM)
  20. 20. #Java17APIs @gunnarmorling The Vector API Examining Assembly Code with Hsdis
  21. 21. #Java17APIs @gunnarmorling The Vector API Examining Native Assembly "conditionally copies byte elements from the source operand to the destination operand depending on mask bits defined in the implicit third register argument" felixcloutier.com
  22. 22. Detour Identifying JDK API Changes by Yourself
  23. 23. #Java17APIs @gunnarmorling Detour: Identifying API Changes javaalmanac.io
  24. 24. #Java17APIs @gunnarmorling Detour: Identifying API Changes github.com/AdoptOpenJDK/jdk-api-diff
  25. 25. #Java17APIs @gunnarmorling Detour: Identifying API Changes chriswhocodes.com/jepsearch.html
  26. 26. #Java17APIs @gunnarmorling Detour: Identifying API Changes JavaDoc ab Version 17
  27. 27. 1 JFR Event Streaming 3 2 The Vector API The Foreign Linker API
  28. 28. #Java17APIs @gunnarmorling ● Accessing native Memory (JEP 383) ● Accessing native APIs (JEP 389) ○ Moving specific parts to native code ○ Using existing native libraries ● Vector API Projekt Panama Integration of JVM and Native Code
  29. 29. #Java17APIs @gunnarmorling Foreign Linker API Using Method Handle
  30. 30. #Java17APIs @gunnarmorling Foreign Linker API Using Method Handle
  31. 31. #Java17APIs @gunnarmorling Foreign Linker API Using Method Handle
  32. 32. #Java17APIs @gunnarmorling ● Provide or create header file ● Generate binding (Panama EA build required) Foreign Linker API jextract
  33. 33. #Java17APIs @gunnarmorling Foreign Linker API jextract
  34. 34. #Java17APIs @gunnarmorling Foreign Linker API github.com/sundararajana/panama-jextract-samples
  35. 35. Detour Removed APIs
  36. 36. #Java17APIs @gunnarmorling ● RMI Activation ● Pack 200 ● Nashorn JavaScript-Engine ● Deprecated for Removal in Java 17 ○ Applet API ○ Security Manager Detour: Removed APIs Tackling the Maintenance Burden → 🤷 → 🤷 → Standalone Nashorn (since Java 15), GraalJS
  37. 37. 1 JFR Event Streaming 2 3 The Vector API The Foreign Linker API
  38. 38. #Java17APIs @gunnarmorling OpenJDK Flight Recorder ● “JVM framework for troubleshooting, monitoring and profiling” ● 150+ built-in event types ● Support for custom events ● Open source since Java 11 ● Meant for “Always on” usage in production
  39. 39. #Java17APIs @gunnarmorling JFR Event Types https://bestsolution-at.github.io/jfr-doc/
  40. 40. #Java17APIs @gunnarmorling JFR Event Streaming JEP 349 ● Processing JFR events in “real-time” ● Use Cases ○ Export to monitoring services ○ Performance tests (JfrUnit) ○ Predictive analytics
  41. 41. #Java17APIs @gunnarmorling JFR Event Streaming API
  42. 42. #Java17APIs @gunnarmorling JFR Event Streaming Out-of-process: github.com/flight-recorder/health-report
  43. 43. #Java17APIs @gunnarmorling ● Performance tests based on metrics like latency/throughput often unstable ● JfrUnit ○ Assertions based on proxy metrics ○ Plain JUnit-Tests ○ Analysis via JDK Mission Control JFR Event Streaming Use Case: Performance Regression Tests with JfrUnit “Unit testing, for performance”
  44. 44. #Java17APIs @gunnarmorling JFR Event Streaming Asserting Socket IO with JfrUnit
  45. 45. #Java17APIs @gunnarmorling JFR Event Streaming Asserting Socket IO with JfrUnit
  46. 46. #Java17APIs @gunnarmorling JFR Event Streaming Asserting Socket IO with JfrUnit
  47. 47. #Java17APIs @gunnarmorling JFR Event Streaming Asserting Socket IO with JfrUnit
  48. 48. #Java17APIs @gunnarmorling JFR Event Streaming Asserting Socket IO with JfrUnit
  49. 49. Detour AppCDS
  50. 50. #Java17APIs @gunnarmorling JFR Event Streaming Asserting Socket IO with JfrUnit
  51. 51. #Java17APIs @gunnarmorling ● Class Data Sharing: Memory mapped class metadata ● Default CDS archive for JDK classes since Java 12 (JEP 341) ● AppCDS: CDS archive for your own classes Detour: Faster Start-up with AppCDS No Need to Go Native?
  52. 52. #Java17APIs @gunnarmorling Detour: AppCDS Quarkus App – Time to First Response Hetzner Cloud CX4 (4 vCPUs, 16GB RAM)
  53. 53. #Java17APIs @gunnarmorling Detour: AppCDS Start-up Time of Apache Kafka
  54. 54. #Java17APIs @gunnarmorling Java 17 – An Update Well Worth It! Many Improvements Across the Board... Language API Runtime
  55. 55. #Java17APIs @gunnarmorling What We Didn’t Talk About... New Language Features
  56. 56. #Java17APIs @gunnarmorling ● Shenandoah GC ● Improvements to native GraalVM binaries ○ JFR support ○ Debug symbols ● AArch64/Linux port; project Lilliput ● Persistent memory support (JEP 352, mashona.io) ● Supported OpenJDK distribution Red Hat & OpenJDK Past and Current Contributions
  57. 57. #Java17APIs @gunnarmorling ● JEP Search https://chriswhocodes.com/jepsearch.html ● Blog (Vector API, JFR Event Streaming, AppCDS, etc.) https://www.morling.dev/ ● JfrUnit https://github.com/moditect/jfrunit ● Red Hat build of OpenJDK https://developers.redhat.com/products/openjdk/overview Resources
  58. 58. #Java17APIs @gunnarmorling Q&A gunnar@hibernate.org @gunnarmorling 📧 Contact

×