Wild(Fly) far and away

TheJasoct evolution of the JBoss

AS Project Lead

May 4, 2011

Dimitris Andreadis

Sr. Engineering Manager Red Hat JBoss EAP/WildFly

twitter: @dandreadis How it all started? (for me*)

*http://dandreadis.blogspot.ch/2014/10/10-years-on-red-pill.html JBoss AS/EAP, WildFly Fan(atic) about.me/dandreadis •2001, JBoss User •2003, JBoss Committer •2004, JBoss Full-time Core Developer •2006, JBoss AS Lead (v3.2.8+, v4.0.4+, v4.2.x, 5.0.x) •2009, JBoss AS Engineering Manager •2013, JBoss EAP/WildFly Sr. Engineering Manager

And before JBoss? •7y experience in distributed systems (telcos, NMS/OSS) •BSc/MSc Computer Science (Athens/Dublin) Agenda • Enterprise • JBoss AS History • WildFly Update

Enterprise Java Application Servers • Provide a runtime for mission-critical applications • Solve the Many (clients) to Few (resources) problem • User code doesn't have to deal with • Security • Transactions • Threading • Pooling • Caching • Connectors • Messaging • Clustering • … J2EE Timeline • JPE (May 1998) • Java Professional Edition project announced at Sun • J2EE 1.2 (Dec 1999) • JNDI, Servlet, JSP, EJB, JMS, JTA, JDBC, RMI-IIOP, etc. • J2EE 1.3 (Sep 2001) • JCA, JSTL, JAAS, (EJB 2, Servlet 2.3, JSP 1.2, JDBC 2) • J2EE 1.4 (Nov 2003) • JFS, JAXP, JAX-RPC, JAXR, JMX, (EJB 2.1, Servlet 2.4, JSP 2.0, JCA 1.5, etc.) Java EE Timeline • Java EE 5 (May 2006) • Annotations based EJB3/JPA, JAX-WS, SAAJ, … • Java EE 6 (Dec 2009) • JAX-RS, CDI, Bean Validation, Managed Beans, Interceptors, Web-Profile, pruning process • Java EE 7 (Jun 2013) • , JSON, Async Servlet, NIO, Batch, Concurrency utilities, JMS 2, JDBC 4, (-CMP, -JSR88), etc.

• Java EE 8 (WIP, expected 2017) • HTTP/2, SSE, JCache, JSON-B, MVC (-EJB 2, - IIOP), etc. Java EE Value Proposition • Comprehensive set of Standard APIs • Implementations to backup those APIs • Extensively Tested & Certified to work together • Backward & Forward Compatibility guarantees • Reasonable Portability across vendors

Java EE Concerns • Memory and Disk Footprint • Container Complexity • Start-up Speed • Testability

JBoss AS History (E)JBoss • An Open Source J2EE* Server • Founded by Marc Fleury in 1999 • Backed by a community of developers • Yet Another Java AppServer (out of 30+)

*J2EE -> Java EE == Java Enterprise Edition What made JBoss special? • Open Source • Commercial Servers at $10k - $100k+ • LGPL licensed • Freely Use/Distribute/Embed • Change JBoss => contribute changes back • Developer friendly • Easy installation : unzip and run! • Hot deployment, no pre-compilation steps, etc. • Innovative design • Lightweight, modular, dynamic

What made JBoss special? • Open Source • Commercial Servers at $10k - $100k+ • LGPL licensed • Freely Use/Distribute/Embed • Change JBoss => contribute changes back • Developer friendly • Easy installation : unzip and run! • Hot deployment, no pre-compilation steps, etc. • Innovative design • Lightweight, modular, dynamic

*http://burrsutter.blogspot.ch/2007/07/beginning.html Architectural Innovations The JBoss MicroKernel • A lightweight component framework that wires together a set of Services • Services are de-coupled, invocations are routed through an internal bus Architectural Innovations Aspect Oriented Design (since 2001!) • Interceptor chain created at run-time using Dynamic Proxies Architectural Innovations Instant Clustering • Nodes discover each other using multicast JBoss AS Timeline

JavaEE 6 Full Profile, JDK6/JDK7 Complete Clustering Support, EAP6 basis

JavaEE 6 Web Profile, JDK6/JDK7 Modular Service Container Architecture JBoss AS 7.1, 7.1.1 JavaEE 6 Web Profile, JDK6

JBoss AS 7.0, 7.0.1, 7.0.2 JSF-Based Console, EAP5 basis

JBoss AS 6.0, 6.1 JavaEE 5 certification, JDK5 & 6 MicroContainer Architecture JBoss AS 5.1 J2EE 1.4 certification

JTS, JDK 1.4 JBoss AS 5: 5.0.0.GA, 5.0.1.GA

JBoss AS 4.2.0 – 4.2.3

JBoss AS 4.0.0 – 4.0.5 JEE 5.0 compatible, not certified (95% pass) JDK5.0, EAP 4.2 basis

JBoss Versions JBoss JBoss AS 3.2.0 – 3.2.8 Time

2003 2004 2005 2006 2007 2008 2009 2010 2011 2012

J2EE 1.3, JDK 1.3 JMX MicroKernel Architecture Red Hat Acquisition Project vs EE spec • JBoss AS 2  J2EE 1.2 • JBoss AS 3  J2EE 1.3 • JBoss AS 4  J2EE 1.4 • JBoss AS 5  Java EE 5 • JBoss AS 6 , AS7  Java EE 6 • WildFly 8, 9, 10  Java EE 7 Project vs EE spec vs Product • JBoss AS 2  J2EE 1.2 • JBoss AS 3  J2EE 1.3 • JBoss AS 4  J2EE 1.4  EAP 4 • JBoss AS 5  Java EE 5  EAP 5 • JBoss AS 6 , AS7  Java EE 6  EAP 6 • WildFly 8, 9, 10  Java EE 7  EAP 7

*Red Hat JBoss Enterprise Application Platform (EAP) WildFly vs JBoss EAP JBoss AS Kernel Taxonomy • JBoss AS 2.x, 3.x, 4.x • JBoss JMX MicroKernel

• JBoss AS 5.x, 6.x • JBoss MC - MicroContainer

• JBoss AS7.x, WildFly 8.x, 9, 10 • JBoss MSC - Modular Service Container A hard look at the mirror (2010) • Typical Pain Points • Excess baggage (legacy subsystems and abstractions) • Boot time & memory footprint • Embeadability/testability • Administration options • Modularity

• It’s “free and it doesn’t suck” not enough anymore

Getting our Mojo back! • Major Goals • Make it Smaller, Faster • Improve Manageability • Simplify Configuration

• Clean things up! • Remove abstraction layers • Remove legacy stuff • Modularize

AS7 Innovations - MSC Modular Services Container (MSC) • Small, lightweight, and efficient • Highly concurrent & scalable state machine • Multiple startup modes •Active, Passive, On-Demand, Lazy, Never

Service Builder

Service Registry

Service Controller

Service Deps Value Listeners Injectors

Concurrent Service Container Innovations – JBoss Modules Small, lightweight, and efficient •Highly concurrent class loading •Fast with O(1) dependency resolution

“Pure” modular class loading •Modules only see what they import •Including JDK classes

External module definitions •Don’t have to break open the JAR Modular Class Loading • A graph of Class Loaders, not a tree • Modules delegate to one another as peers • A module imports modules it directly uses • Transitive dependencies are hidden, by default • Different module versions may co-exist modules\org\hornetq\main\module.xml

So What? #@*%ing fast!

http://community.jboss.org/wiki/AS7StartupTimeShowdown Boot Time Results Memory Comparison @#$% fast: How is it done? • Concurrent startup/deployments • Faster resource lookup/classloading • Annotation indexing • Caching of reflection metadata • Lazy loading of (some) services • StAX based descriptor parsing • Starting from scratch  Two Operational Modes Standalone •Traditional JBoss single JVM server •Management facilities IN-VM •No lifecycle management (only shutdown) Domain •Multi-JVM, multi-server model •Management coordinated by Domain Controller Process •Multiple server instances (JVMs) per Host •Full lifecycle managed by Process Controller

Domain Mode User-focused Configuration

@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=TransactionManager", exposedInterface=com.arjuna.ats.jbossatx.jta.TransactionManagerServiceMBean.class, registerDirectly=true)

@org.jboss.managed.api.annotation.ManagementObject(name="TransactionManager",[email protected] oss.managed.api.annotation.ManagementComponent(type = "MCBean", subtype = "JTA"),targetInterface=com.arjuna.ats.jbossatx.jta.TransactionManagerServiceMBean.class)

300 ${jboss.server.data.dir}/tx-object-store

Management APIs • Command Line Interface (CLI) • Remote Java API • HTTP/JSON API • GWT-based console • JMX mapping

1st Class Components WildFly Update JBoss Name Overload • JBoss Application Server (the project) • JBoss Company (jboss.com) • JBoss Community (jboss.org) • JBoss Projects (e.g. JBoss Cache) • JBoss Product Line (EAP, SOA-P, etc.)

V8 Recap WildFly 8 – Features* • 100% Java EE7 certified (Web & Full profiles) • plus CDI 1.2, WebSockets 1.1 • High Performance Web Server (Undertow) • Port reduction (8080, 9990) • Update Infrastructure • Role Based Administration (RBAC) • Audit Logging

*WildFly 8.0 Final – Feb/2014 EE7 Highlights EE7 Highlights – New Techs JSR-352 Batch Applications for the Java Platform •Runtime & Artifact API, XML-based Job specification lang.

JSR-236 Concurrency Utilities for JavaEE •Executor, Scheduled Executor, Thread Factory, Context

JSR-353 Java API for JSON Processing (JSON-P) •Parse, transform and query JSON data

JSR-356 Web Sockets support •Annotation driven endpoints and lifecycle callbacks

EE7 Highlights – Spec. Updates JSR-345 EJB 3.2, plus Interceptors 1.2, Annotations 1.2 •Misc. improvements JSR-340 Servlet 3.1 •Non-blocking I/O, HTTP upgrade, etc. JSR-342 JMS 2.0 •Shared topic subs, delayed delivery, async send, etc. JSR-344 JSF 2.2 •HTML 5, FaceFlows, Stateless Views, Resource lib contracts JSR-322 JCA 1.7 •Activation name for msg endpoints (WTF?)

EE7 Highlights – Optional Techs Removed in WildFly 8 •EJB 2.1 Entity Beans (CMP/BMP) •JAX-RPC (API for XML-based RPC) •JAXR (API for XML Registries) •JSR-88 (Deployment API) • it has re-surfaced in JSR 373 (JSR-77 successor) JavaTM EE Management API 2.0  New WebServer - Undertow • Blocking / non-blocking NIO based APIs • Composition/handler based architecture • Lightweight & fully embeddable • Supports WebSockets, including JSR-356 • Supports Servlet 3.1 • HTTP upgrade

http://undertow.io/ Undertow – Embedded Server Port Reduction • HTTP Upgrade allow us to reduce the number of ports in the default installation to just 2: • 8080 – for applications with JNDI and EJB multiplexed • 9990 – for management, for both HTTP/JON & Native APIs

• The only overhead is the initial HTTP Upgrade request/response.

Updating an installation • Preserves configuration and deployments • Can be applied offline or on a running server

./bin/jboss-cli.sh [disconnected /] patch apply /-8.2.0.Final.patch [disconnected /] quit

patch rollback --reset-configuration=true patch --help

Administrative Access Control • Administrative users can be mapped to Roles • Role = set of Permissions • Permission: • Action (access, read/write config, read/write runtime) • Set of Constraints (target) • Sensitive resource type, attribute or operation • Sensitive data • Audit Resource • Application Resource Roles Monitor – reads non sensitive configuration and state Operator – Monitor + start/stop server & queues Maintainer – Operator + deploy Apps & Queues Deployer – Maintainer + config Apps Administrator – Maintainer + system config - audit logging Auditor – Monitor + audit logging config SuperUser - Everything Administrative Audit Logging • Logging of connection / authentication events • Logging of management operations • Log Message as JSON Records • Audit Logging Handlers • Local file • Syslog (UDP / TCP / TLS) V9 Update WildFly 9 – Features* • Core/Full Split and Servlet-only distribution • Front-end load balancer with mod_cluster support • Undertow HTTP/2 & SPDY support • Graceful shutdown (suspend(timeout)/resume) • Switching to the JDK ORB from JacORB • Offline CLI Mode • etc.

*WildFly 9.0 Final – Jul/2015 WildFly-Core Base Runtime for WildFly server includes • Modular class loading • Modular Service Container • Unified management, including domain mode • Basic deployment architecture • CLI for management • Logging JBoss MSC DMR Controller Threads • JMX Modules

Server Controller Service Reflect Deployers VFS Jandex Repository Cache Core Infrastructure WildFly-Web • Servlet-Only distribution • Undertow and Naming added

Include your own frameworks

WildFly distro extensions

WF-Full ~380 services WF-Servlet distro extensions

WF-Servlet ~100 services WF-Core distro extensions

WF-Core ~58 services Experimental: wildfly-swarm* Turn your .war into a fat jar with just enough of the WildFly Runtime to support your use case • Include the wildfly-swarm-plugin in your pom.xml

• Declare any dependencies on: Undertow, JAX-RS, Naming/JNDI, Transactions, Messaging, Datasources, Logging, Weld/CDI, MSC Security

*http://wildfly.org/news/2015/05/05/WildFly-Swarm-Released/ Experimental: wildfly-swarm

[ Write your own main() to override default configuration and reference it in your MANIFEST.MF ]

Voila! java –jar myapp-swarm.jar

(boots in < 1sec)

WF/Undertow as Load Balancer • Full Java solution controlled centrally • Implements mod_cluster • HTTP, HTTP/2, AJP

http://blog.eisele.net/2015/01/developer-interview-di-11-stuart-douglas-about-wildfly9-undertow.html HTTP/2 (vs HTTP/v1.x) Primary goal of HTTP/2 is to reduce latency and make efficient use of the TCP connection.

Undertow HTTP/2 support HTTP/2 characteristics • Binary Framing • Request/Response multiplexing • Header compression (HPACK) • Stream prioritization • Server Push • HTTP Upgrade or NPN/ALPN*

Undertow implements HTTP/2 (& SPDY)

*requires special JDK8 setup JSR-369 Servlet 4.0 Brings HTTP/2 Support to Java EE8 • Server Push • Stream Prioritization • Request/Response Multiplexing

JEP 110: HTTP/2 Client • Basic Protocol Support in Java SE 9 • new HTTP client API that implements HTTP/2 and WebSocket, and can replace the legacy HttpURLConnection API

http://stackoverflow.com/questions/10480122/difference-between-http-pipeling-and-http-multiplexing-with-spdy Server Push with Undertow

or use the Undertow Learning Push Handler • learns which requested resources are requested per page and pushes them proactively

http://undertow.io/blog/2015/03/25/Server-Push.html Graceful Shutdown • Essentially suspend(timeout) / resume() • Allow active sessions/requests/in-flight-tx to complete • After suspend the server may be restarted

• Action per subsystem may vary • Reject new requests (HTTP Error 503 - Service unavailable) • Clustering could fail over sessions • mod_cluster could notify load balancer • …

V10 Update WF 10 – Roadmap Alpha1 – May/15th Alpha2 – Jun/2nd Alpha3 – Jun/16th Alpha4 – Jun/30th …bi-weekly CR1 – Sep/2015  We are Here CR2 – Sep/2015 Final – Oct/2015 WF10 Features • WildFly Core v2 • Require Java 8+ • HornetQ  ActiveMQ Artemis • JMS Graceful Shutdown • HA Singleton Deployments • Improved UI for large domains • Hierarchical Profiles • Offline CLI for Domain Mode • Server-side JavaScript support (Undertow.js) http://wildfly.org/joinus/