WildFly AppServer - State of the Union
as presented at SoftShake Geneva, Oct 2015
http://soft-shake.ch/2015/en/
Covering the whole WildFly v8/9/10 series and the key aspects of the base AS7 architecture.
10. 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
11. 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
Concurrent Service Container
Service Controller
Service Registry
Service Builder
Service Deps Value Listeners Injectors
12. 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
13. 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
19. @#$% 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
20. 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
30. 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
32. 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
33. 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/
35. 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.
36. 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
40. 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
41. 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
• JMX
MSC
JBoss
Modules
DMR Controller Threads
Core Infrastructure
Server Controller Service
Deployers VFS Jandex
Reflect
Cache
Repository
50. 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/
51. 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)
55. 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
56. 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
57. Server Push with Undertow
http://undertow.io/blog/2015/03/25/Server-Push.html
or use the Undertow Learning Push Handler
• learns which requested resources are requested per
page and pushes them proactively
58. 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
• …