nine neins - where java ee will never take you

42
Nine “Neins” – Where Java EE will never take you. @myfear blog.eisele.net https://keybase.io/myfear

Upload: markus-eisele

Post on 09-Jan-2017

10.531 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Nine Neins - where Java EE will never take you

Nine “Neins” – Where Java EE will never take you.

@myfearblog.eisele.net

https://keybase.io/myfear

Page 2: Nine Neins - where Java EE will never take you
Page 3: Nine Neins - where Java EE will never take you

Disclaimer

https://jcp.org/aboutJava/communityprocess/mrel/jsr342/

Page 4: Nine Neins - where Java EE will never take you

How did we get here?

Page 5: Nine Neins - where Java EE will never take you

Classical Architectures?

Page 6: Nine Neins - where Java EE will never take you

ApplicationServer

EAR- EnterpriseArchive

RESTMobileWebUI

.JAR.JAR.JAR

.JAR.JAR.JAR.JAR

.JAR.JAR.JAR

Browser RDBMS

Page 7: Nine Neins - where Java EE will never take you

ApplicationServer

ApplicationServer

ApplicationServer

EAR- EnterpriseArchive

RESTMobileWebUI

.JAR.JAR.JAR

.JAR.JAR.JAR.JAR

.JAR.JAR.JAR

Browser RDBMS

Page 8: Nine Neins - where Java EE will never take you

LL: Building and Scaling Monoliths• Monolithic application – everything is

package into a single .ear• Reuse primarily by sharing .jars• A “big” push to production once or twice a

year• Single database schema for the entire

application• >= 500k loc• >= Heavyweight Infrastructure• Thousands of Testcases• Barely New Testcases

• >= 20 Team Member• The single .ear requiring a multi-month

test cycle /• Huge bug and feature databases• User Acceptance Undefined• Technical Design Approach• Barely Business Components or Domains• Requiring multiple team involvement &

significant oversight• Technical Dept• Outdated Runtimes (Licenses, Complex

updates)• Grown applications

Page 9: Nine Neins - where Java EE will never take you

More users

http

://w

ww

.inte

rnet

lives

tats

.com

/inte

rnet

-use

rs/

J2EE

Spring

RoR

Akka

Reactive Manifesto

Microservices

Page 10: Nine Neins - where Java EE will never take you

New requirements• Rather than acting on data at rest, modern

software increasingly operates on data in near real-time.

• Shortened time-frames for putting changes into production

• New business models evolve from existing ones

• New questions need to be answered by existing applications

• Datacenter costs need to go down constantly

Page 11: Nine Neins - where Java EE will never take you

“It’s increasingly obvious that the old, linear, three-tier architecture model is

obsolete.” - Gartner

Page 12: Nine Neins - where Java EE will never take you

Modernization!

Page 13: Nine Neins - where Java EE will never take you

Module

Module

Module

WebUI

.JAR.JAR.JAR

.JAR.JAR.JAR.JAR

.JAR.JAR.JARBrowser RDBMS

RDBMS

RDBMS

Page 14: Nine Neins - where Java EE will never take you

RoutingModule

TrackingModule

OrderModule

Tracker UIBrowser HistoryDB

OrderDB

RoutesDB

Tracker UI

Tracker UI

Browser

Browser

Page 15: Nine Neins - where Java EE will never take you

REQ: Building and Scaling Microservices

• Lightweight runtime• Cross – Service Security• Transaction Management• Service Scaling• Load Balancing• SLA’s• Flexible Deployment• Configuration• Service Discovery• Service Versions

• Monitoring• Governance• Asynchronous communication• Non-blocking I/O• Streaming Data• Polyglot Services• Modularity (Service definition)• High performance persistence (CQRS)• Event handling / messaging (ES)• Eventual consistency• API Management• Health check and recovery

Page 16: Nine Neins - where Java EE will never take you

What does Java EE bring to the table?

Page 17: Nine Neins - where Java EE will never take you

JAX-RS

JSON-PWeb SocketServlet

JSFELJSP JSTL

Bean

Val

idat

ion

Inte

rcep

tors

CD

I

Con

curre

ncy

JPA

JTA EJB JMS

Batch

JCA

Java EE 7

JavaMail

Page 18: Nine Neins - where Java EE will never take you

NINE “Neins”!

Definition: a “Nein” is a lost benefit of a microservice based system.

Page 19: Nine Neins - where Java EE will never take you

1) Java EE helps building distributed monoliths• 100s of libraries are part of the base platform• Upgrading individual libraries partly impossible

(e.g. RIs) • Requires client libraries (e.g. JAX-RS and JMS) <=

logic drifts into the client.• Doesn’t support other languages and can’t really

embrace the polyglot approach to microservices• No independent technical evolution in teams

because of the common base platform

Page 20: Nine Neins - where Java EE will never take you

2) Java EE has a threading-model that isn’t ideal for microservices• Request to thread binding.• Can’t be scaled to thousands of servers easily.• Responsiveness isn’t build in from the core.• Clustering isn’t part of the specification and relies

on vendor specific features.• No standardized asynchronous approach for

endpoints (e.g. JAX-RS, JAX-WS)

Page 21: Nine Neins - where Java EE will never take you

3) Java EE doesn’t support the notion of data in motion (streams)• JDBC and JPA block on Socket I/O

• important methods are synchronized, thereby allowing only one query at a time on one connection.

• Batch processing as default way to handle bulk updates.

• Not even Java 8 Lambdas usable because Fork/Join and Concurrency Utilities doesn’t play nicely together in a managed environment

http://mail.openjdk.java.net/pipermail/lambda-dev/2013-April/009335.html

Page 22: Nine Neins - where Java EE will never take you

4) Java EE doesn’t support resiliency

• No notion of replication, containment, isolation or delegation.

• With the exception of vendor specific features (which require clustering)

• Failures are propagated and not contained• One component failure usually brings down the

complete application• No support for bulkheading. Clients have to handle

failures.

Page 23: Nine Neins - where Java EE will never take you

5) Java EE is implemented as containers – no service elasticity• Containerless development impossible

• Testing is hard (Arquillian makes it bearable)• No simple development models

• Compile, Build, Deploy – cycles for every microservice

• No class-reloading (unless you use AMAZING tools like JRebel :-D)

• No increasing or decreasing of resources under various workloads. (Back-pressure)

• With the exception of vendor specific features (which require clustering)

Page 24: Nine Neins - where Java EE will never take you

6) No notion of immutability

• Handling of large amounts of data within distributed systems requires immutability for data

• Immutable services are the new paradigm in load balancing, high availability, and dynamic resource sharing.

• JPA works well with RDBMS• CQRS and Event-Sourcing work well with

immutable data-structures and are beneficial for microservices.

http://cidrdb.org/cidr2015/Papers/CIDR15_Paper16.pdf

Page 25: Nine Neins - where Java EE will never take you

7) Choice of data stores, use of transactions and eventual consistency• No NoSQL support in Java EE• Polyglot persistence only possible in very few

frameworks.• Heavily embracing distributed transactions with

2PC.• Eventual consistency is ignored and discouraged

http://adrianmarriott.net/logosroot/papers/LifeBeyondTxns.pdf

Page 26: Nine Neins - where Java EE will never take you

8) No outer architecture – while still calling it a platform• Monitoring• Distributed Logging• Security• Service discovery• Service locator• API versioning• Routing• …

Page 27: Nine Neins - where Java EE will never take you

9) Java EE doesn’t know services

• No service component model• No service templates• Hardly any endpoint documentation (WSDLs)• No service boundaries • No way to enforce decoupling

Page 28: Nine Neins - where Java EE will never take you

You can do it in this way, but then it sucks!

Page 29: Nine Neins - where Java EE will never take you

Possible Alternative:Reactive Application

(Lagom, Akka, Play, Vert.x, …)

Page 30: Nine Neins - where Java EE will never take you

http://www.reactivemanifesto.org/

Page 31: Nine Neins - where Java EE will never take you

Reminder:Technology alone

won’t solve all the new challenges

Page 32: Nine Neins - where Java EE will never take you

Software DesignSystem Architecture

Methodology and Organization

Distributed Systems Theory

Data Center Operating System

Page 33: Nine Neins - where Java EE will never take you

“Rules are for the obedience of fools and the guidance of wise men.”

Generally attributed to Douglas Bader

Page 34: Nine Neins - where Java EE will never take you

Written for architects and developers that must quickly gain a fundamental understanding of microservice-based architectures, this free O’Reilly report explores the journey from SOA to microservices, discusses approaches to dismantling your monolith, and reviews the key tenets of a Reactive microservice:

• Isolate all the Things• Act Autonomously• Do One Thing, and Do It Well• Own Your State, Exclusively• Embrace Asynchronous Message-Passing• Stay Mobile, but Addressable• Collaborate as Systems to Solve Problems

http://bit.ly/ReactiveMicroservice

Page 35: Nine Neins - where Java EE will never take you

The detailed example in this report is based on Lagom, a new framework that helps you follow the requirements for building distributed, reactive systems.

• Get an overview of the Reactive Programming model and basic requirements for developing reactive microservices

• Learn how to create base services, expose endpoints, and then connect them with a simple, web-based user interface

• Understand how to deal with persistence, state, and clients

• Use integration technologies to start a successful migration away from legacy systems

http://bit.ly/DevelopReactiveMicroservice

Page 36: Nine Neins - where Java EE will never take you

http://bit.ly/SustainableEnterprise

• Understand the challenges of starting a greenfield development vs tearing apart an existing brownfield application into services

• Examine your business domain to see if microservices would be a good fit

• Explore best practices for automation, high availability, data separation, and performance

• Align your development teams around business capabilities and responsibilities

• Inspect design patterns such as aggregator, proxy, pipeline, or shared resources to model service interactions

Page 37: Nine Neins - where Java EE will never take you

https://www.reactivesummit.org/

Page 38: Nine Neins - where Java EE will never take you
Page 39: Nine Neins - where Java EE will never take you

Links and further reading

Page 40: Nine Neins - where Java EE will never take you

ProjectSite:http://www.lightbend.com/lagom

GitHubRepo:https://github.com/lagom

Documentation:http://www.lagomframework.com/documentation/1.0.x/java/Home.html

CargoTrackerExample:https://github.com/lagom/activator-lagom-cargotracker

Page 41: Nine Neins - where Java EE will never take you

•Keep all data in memory!• Store all state changes as events• Replay all events of an actor to recreate it • Strong consistency for Actor (aggregate) and Journal• Eventual Consistency for Read Side

https://msdn.microsoft.com/en-us/library/jj554200.aspx

Page 42: Nine Neins - where Java EE will never take you

https://www.infoq.com/minibooks/domain-driven-design-quickly