Here are my notes from the talks I attended on Day Four of OracleCodeOne. Some excellent content – feel free to engage me on twitter at @markee174 if you have any questions.
Microservices Essentials: Kubernetes and Ecosystem, Data, and Transaction Patterns [DEV1730]
Good for microservices and provides lots of features such as load balancing
OKE adds a service Broker to Kubernetes
Kubernetes does not provide Strong and Clear API contract, Service discovery, etc.
Microservices Data management patterns – CQRS
Some nice code slides on setting up. Can have a single database for all data models
PDB sharding for Microservices – allows you to keep German data in Germany for example
Intelligent schema refactoring
Look at extra features Oracle adds such as constraints.
Nice shopping demo using all features
Reactive Microservices in Action [DEV4322]
Talk about reactive services talking to each other
Example of 2 services calling each other synchronous and asynchronous (using CompletableFuture)
Microservices are like kids – misbehaved most of the time.
Microprofile provides fault tolerance. Includes @retry, @CircuitBreaker and @Bulkhead
Containers about sharing and deployment density. How to manage concurrency effectively?
Needs to be asynchronous and non-blocking – reactive
Reactive is all about streams (in Java9) with a Subscriber, Processor and a Publisher
Nothing happens until you subscribe and make a request
Don’t implement Reactive Streams yourself! – Use Reactor, Rx, Microprofile Reactive Streams operator.
Demo and code to link 2 microservices in Microprofile. Using Kafka to map topics onto channels
Walkthrough demo on code running 2 microservices with service a and service b
Hunting Down Scalability Bottlenecks in Java [DEV3217]
Still, lots of audiences using Java8 in production
Concurrency is only about performance
On scalability, Strategy should be to find limiting resource.
Amdahl’s law / universal scaleability law
The ideal is threads = cores.
Main reason Threads < Cores due to lack of parallelism, don’t control threads, intentional (ie spare cores for better latency or power usage reduction), incorrect HW detection
Threads > Cores due to lack of control, intentional, Incorrect HW detection. vmstat useful for debugging this case
Since Java10 fixed detection of CPUs including on cloud
HyperThreading not designed to provide scaling and may result in slowdowns
Lots of low-level hardware discussion and showing how too many threads can reduce performance
a byte is an abstraction
Locks everywhere in software and can cause performance issues
Typical mistakes to overuse – too many data items, too many, too small a lock. Can be hunted down in java logs and mission control
Threads are a limited resource so should be used carefully
Fibers will reduce the cost of threads, especially starts and stops
Design a Clean Architecture as a Real Craftsman [DEV6006]
Get a list of 10 questions from the audience. Try to cover as many as possible…
1. What do we define as clean architecture?
The classic answer is It depends
All about Simplicity
Very hard to define – someone we ‘know when we see it’
Means to an end, not an end in itself and avoid over-engineering
Mentioned book on Clean coding
2. How to secure microservices? app level? service mesh? both?
Think about security last suggestion led to lively audience discussion
3. What is the best way to communicate architecture concepts to developers?
Code should be self-documented as possible. Architecture starts with small things – ie variable names indicate intent. Domain-driven design
Use Design patterns
4. How to expand a “clean architecture” to other projects in an organization?
5. gRPC v Rest v Messaging – pros and cons?
Choose on the basis of the specific use case
6. How to keep a clean architecture in a project?
7. What are the most common misconceptions on modularity?
8. How to measure cleanness on a project architecture?
Tools like SonarCube can help
9. Efficiency, ease of use, performance
10. Is there any damage when adopting clean architecture?
Advanced Topics in Modularization [DEV4352]
Migrating is hard
The first step upgrade to latest tooling. Maven 3.8.1 supports modulepath
Major benefit is modular JVM with JLink
No support for Java modules in Jakarta EE.
CDI and jlink is extremely challenging
Module names must be unique and should not end in a numeral.
Eagerly load and application will not run without module.
No support for versioning but layers can load different versions
2 modules with same package names in them are considered different versions of the same module.
jpeds can generate module-info.java for jar file.
Split packages not allowed so must be refactored.
OpenJDK has a package scanner to spot split packages
Use VarHandle (Java9) to pass reflective access to modules
transitive keyword for transitive dependencies
Services were added in Java and changed for Jigsaw
For troubleshooting jar-describe-module-fir and java-module-path settings
jlink only works with named modules.
There is a jlink plugin for maven
Type Inference: Friend or Foe? [DEV3876]
Statistically typed languages that heavily favor type – Haskell, Scala, Kotlin
More ‘typing’ (ie need to add in) in a less statically typed language
Moving towards static typing – c#, Java C++
Java started with type inference in Java5 with generics
Java7 – diamond, limitation
Java8 – lambda type inference, a few limitations (no annotation unless you specify the type, not enough context)
Java9 – support for anonymous classes
type inference for local variables,
only when type 100% clear ie var greet; greet=”string” will not work)
var works in for and try with resources, not for fields or parameters
do not use with diamond
Collection issue made worse if you use var(ie remove(n) will remove the n value in some and the nth value in others)
base versus derived as type inferred from what is known
lambdas do not have a type, just what it can bind to
easy to evolve
easier to reuse
lifesaver during debugging
targeted intersection types
anonymous non-denotable types
var is not a keyword
var of lambda parameters
limitations (can’t mix var and types or implicit types)
Useful for annotations
var is not a keyword
Don’t use <>
DOn’t put type info in name
Make sure type what you want
specify type unless dead obvious
use var for temp, debugging
use for reuse
Our Experience in Writing a Kubernetes Operator [DEV5377]
Based on work done by weblogic team
Domain custom resource – created one for weblogic
Architecture is a Java application in Docker image
Helm chart creates Deployment, RBAC and other resources
Domain resource is always a source of truth!
Main weblogic operator written in Java
2 client libraries: Fabric8 and Kubernetes client. Chose the latter
Issues while using Custom Resource Definitions-
1.watching for updates. Events can arrive out of order. Recommendation to implement Informer pattern
2. Status and events.
3. CRD versioning. Can only upgrade from 1.11
Testing is done with Unit for Java and Helm
Docker image scanning with Clair
Developers can run integration tests against local cluster
Adding support for Istio
Do you need to solve any of these problems in Java?
Convert PDF to HTML5
Convert PDF to SVG
View Forms in the browser
View PDF Documents
Convert PDF to image
Extract Text from PDF
Convert Image to PDF