Upgrade to Pro — share decks privately, control downloads, hide ads and more …

JDK10: What to expect from Developer's view

JDK10: What to expect from Developer's view

Slides from my recent talk

Muktesh

March 02, 2018
Tweet

More Decks by Muktesh

Other Decks in Programming

Transcript

  1. WHO AM I u Senior Software Engineer at Capital One

    LLC u Interested in open-source, cloud and technology evangelism u Experienced in various Full stack technologies (UI to backend with DevOps added latest in armory) u Technical conference and meetup junkie u Open source contributor to various open source and Apache products (eg: Hystrix, Spinakker, etc.) u Reviewer in various JSRs u President, founder and member of various organizations/groups • Sunnyvale Java User Group • San Francisco Java User Group • Google Developer Group (SF Edition) • Java Community Program u Twitter: • https://twitter.com/mukteshkrmishra u Linked-in • https://www.linkedin.com/in/mukteshkrmishra/
  2. Objective u This talk is based on my experiences while

    playing with JDK 10 EA releases. u We are going to walk through 10 JDK 10 features * which could be game changer for developers. * Disclaimer: Please note for every release these features are tracked through either Java Enhancement Process (JEP) or Java Community Process (JCP) and some of these features can be discarded in final version (GA).
  3. Hmm… some back ground first: u Over the years Java

    has evolved as an eco system rather than a programming language with usage in light weight systems to doing heavy lifting of batch processing in distributed systems. u We all know Java has gone now into most discussed 6 months release cycles with Java 10 is already knocking the door and Java 11 is getting ready for September release. u Finally, wait is over and Java 10 (JDK10) is scheduled for coming in March for general availability. However as a member of Java review community, I got my hands dirty on early releases (EA). Although there are around 149 JEPs/JSRs are going to be part of JDK 10, however based on my opinion these features are going to be game changers (especially for developers*):
  4. More Container Support: u Container is the new revolution in

    Software. It has changed the paradigms of Software development to deployment. There are various container solutions available in the market docker, rocker, DCOS and many more) which are suitable for various usages. u With JDK 10 release Java is going to be self aware whether it is running inside a container or on a host. u New JVM options for container to for controlling Memory and CPU settings. Both options will be used for configuring JVM inside container so that it takes Max Heap size from Linux CGroup: u XX:-UseContainerSupport ( to allow the container support to be disabled. Default : True ie: Enabled) u -XX:+UseCGroupMemoryLimitForHeap (to opt-in to using the value in /sys/fs/cgroup/memory/memory.limit_in_bytes as the value for phys_mem) u -XX:ActiveProcessorCount=xx (this allows the number of CPUs to be overridden. This flag will be honored even if UseContainerSupport is not enabled) u -XX:+UnlockExperimentalVMOptions (enables experimental VM options supported for containers)
  5. Local-Variable Type Inference : u Allow the developer to declare

    variable by enhancing type inference in other words declare variables without defining the associated type. u So this becomes legal in Java 10: u var myList = new ArrayList<String>(); u var myStream = list.stream(); u This will be limited to local variables and indexes in loop. u This will not be available for method formals, constructor formals, method return types, fields, catch formals, or any other kind of variable declaration.
  6. Collection improvements: u Like every Java version, there is a

    upgrade has been added to collections. New methods toUnmodifiableList, toUnmodifiableSet, and toUnmodifiableMapwere added to the Collectors class in the Stream package, allowing the elements of a Stream to be collected into an unmodifiable collection.
  7. Accessing non Java APIs through Java (Project Panama): u Creating

    new data layouts in heap u Native metadata definition for JVM u Native-oriented JIT optimizations
  8. Polyglot VM Support (Project Graal : Exposing VM functionalities via

    API): u Through this JDL developers are trying to expose VM functionalities via API. This can be implemented via: u Graal : The Dynamic compiler u Truffle: For implementing languages which uses Graal as compilier u SubstrateVM: to implement Ahead of time compilation of Java applications leveraging Graal u Graal SDK : API collection for Graal VM
  9. Application Class-Data Sharing: u Class data sharing is existing in

    Java since a long time and used for lot of benefits such as improving JVM start up performance and reducing memory by sharing same data between different Java process. u However it has been enhanced to a new level in JDK 10 by allowing the built-in system class loader, the built-in platform class loader, and custom class loaders to load archived classes. Earlier, it was restricted to the bootstrap class loader only. u -XX:+UseAppCDS will allow all class loaders to share data u Also it can be turn off by allowing only specified set of classes to be archived. It can be achieved by turning off entire sharing and only enabling selected sharing.
  10. Improving root certificate configuration (AKA cacerts): u Cacerts key store

    (part of JDK) contains a set of root certs. Currently it comes empty which is why configuring security protocols (such as TLS) becomes a nightmare. With JDK 10 it will provide a default set of root certification certificates in JDK
  11. Improvements in Garbage collection: u Like every other release garbage

    collection is going to be improved a lot. u Parallel full garbage collection for G! garbage collector: u G1 was made default GC in JDK 9 and now it is becoming more powerful by allowing full GC parallel. u Garbage collector interface has been added in JDK which will enable users to configure alternative garbage collectors.
  12. Allocating Heap on multiple devices: u This will enable user

    to allocate JVM heap onto multiple devices u This is a WIP but will enable large applications such as big data applications to run in multiple and heaps. As of now it is not fully decided what will stay in DRAM and what will go in alternate memory location.
  13. Thread local handshakes: u JDK is going to improve a

    lot of efficiency in concurrent code by allowing execution of a callback on threads without performing a global VM safe point. u This will make it easy and cheaper to stop individual threads also improving VM latency since it has to spend less efforts in querying thread states in global VM.
  14. Generic data type creation or generic runtime types (Project Valhalla):

    u This will allow develops to defines flat data types ie: reference free data types in Heap. u This will result in reduced memory usage and increased locality.
  15. My perspective: u Overall, it seems that JDK 10 is

    going to start a series of improvements in a frequent release cycle. The core areas where JDKs roadmap is more focused and committed is containerization and optimization. With a new version coming up in every 6 month we will see a series of improvements in JDK over a course of period. However, I would encourage all of you to go and try out (JDK10) and check all these features by youself. Please note for every release these features are tracked through either Java Enhancement Process (JEP) or Java Community Process (JCP) and some of these features can be discarded in final version (GA).
  16. Useful links: u Open JDK: http://openjdk.java.net/ u JDK 10 Download:

    http://jdk.java.net/10/ u Project Graal: http://openjdk.java.net/projects/graal/ u JEPS: http://openjdk.java.net/jeps/ THANK YOU !