SlideShare a Scribd company logo
@dandreadis
Right size you services
with &
Dimitris Andreadis
Sr. Engineering Manager
Red Hat JBoss EAP / WildFly
@dandreadis
Once upon a time*
*http://dandreadis.blogspot.ch/2014/10/10-years-on-red-pill.html
@dandreadis
“WildFly:
the Swiss Army
Knife of Runtimes”
@dandreadis
Agenda
● WildFly Architecture
● Thinking Microservices
● WildFly Swarm
@dandreadis
WildFly* pre-History
*the server once called JBoss Application Server
@dandreadis
Kernel Taxonomy
● JBoss AS 2.x, 3.x, 4.x
– JMX MicroKernel
● JBoss AS 5.x, 6.x
– JBoss MicroContainer
● AS7.x, WildFly 8.x, 9.x, 10.x
– Modular Service Container
@dandreadis
Modular Service Container
● Small, lightweight and efficient (˜230 kb jar)
● Highly concurrent & scalable state machine
● Various start-up modes
– Active, Passive,
Lazy, Never
Concurrent Service ContainerConcurrent Service Container
Service ControllerService Controller
Service RegistryService Registry
Service BuilderService Builder
ServiceService DepsDeps ValueValue ListenersListeners InjectorsInjectors
@dandreadis
JBoss Modules
● WF_ROOT/jboss-modules.jar (365 kb)
– Highly Concurrent Classloading
– Fast O(1) dependency resolution
– See only the modules you import
– No need to break open the jars
java -jar jboss-modules.jar -mp <module-path> <module-spec>
module.xml
WildFly & WildFly Swarm
@dandreadis
WildFly Architecture
Java EE7 Full & Web
distribution (134 Mb)
standalone/
configuration/
configuration.xml
Servlet-Only
distribution (28 Mb)
standalone/
configuration/
configuration.xml
WildFly & WildFly Swarm
@dandreadis
Out-of-the-box configurations
● standalone.xml – Web Profile++ (default)
– standalone-ha – with clustering
● standalone-full.xml – plus JMS/ActiveMQ, IIOP, JSR77
– standalone-full-ha – with clustering
● domain.xml – full-ha in domain management mode
– Plus load-balancer Profile
@dandreadis
Domain Mode
@dandreadis
Load Balancer Setup
● Fully managed end-to-end
Java-based solution
● WF/Undertow can serve as
– Static file server
– Reverse Proxy
@dandreadis
Next Gen Web Server – Undertow
● JBossWeb replacement
(fork of Tomcat)
● Scalable Async Core w.
Blocking/Non-Blocking APIs
● Handler/Composition
based Architecture
● Lightweight & fully
embeddable
● Servlet 3.1
● Latest Protocol Support
– HTTP/1.x / HTTPS / AJP
– HTTP/2 (Plain & TLS-ALPN)
– Web Sockets (JSR-356)
– Server Sent Events
@dandreadis
Undertow Performance
*source: techempower.com
@dandreadis
Port Reduction using HTTP Upgrade
Only 2 Ports Open by Default
● 8080 – HTTP for Applications
– Upgradable to JNDI, EJB, JMS
● 9990 – HTTP for Management (Console/JSON)
– Upgradable to Native Management API (CLI/JMX)
@dandreadis
Unified Configuration
@dandreadis
Let’s talk Microservices
@dandreadis
What are Microservices?
This slide intentionally left blank
Martin Fowler definition omitted
@dandreadis
What are Microservices?
● A bit like SOA (but smaller?)
● Written in any cool programming language
● By (smaller?) two-pizza teams
● Who break monoliths into (small?) services
● That encapsulate fully some (small?) vertical application aspect
● And run them independently in their own (smaller?) containers
● Using fully automated deployment machinery
● Did I say small?
@dandreadis
What Enabled Microservices?
● Elastic infrastructure, a.k.a the Cloud
● Linux Containers (Docker, Rocket, etc.)
● Orchestration Technologies (Kubernetes, Mesos, etc)
● Continuous Integration / Deployment
● The DevOps movement
Caused by the need for Internet Scale
@dandreadis
Simpler services but more complex environments
*source: wikibon.com/evolving-container-arhitectures
@dandreadis
A Word of Caution
● Every remote call will likely
be x100 slower than an
in-VM call
● You need to actively code
for failure when crossing
VMs
● Sharing state needs to be
well thought of (or avoided)
@dandreadis
A different view of Microservices
@dandreadis
Welcome to WildFly Swarm
@dandreadis
What is WildFly Swarm?
● WildFly Broken Apart
– Decompose and reconstruct WildFly
around your application
– With additional functionality outside Java EE
like NetflixOSS libraries, etc.
– Just enough app-server for your Microservice
packaged into an UberJar
● Part of the JBoss / Red Hat ecosystem
@dandreadis
Why WildFly Swarm?
● Leverage your Java EE expertise
● Build on mature technologies
and a scalable runtime
● Be part of the future of Java EE
and help shape it for the Cloud
Is portability and supportability a thing of the past?
@dandreadis
Rightsize your Runtime around your App
@dandreadis
Pick up the EE pieces you really need
@dandreadis
Plus a lot more components!
● Keycloak (SSO)
● Hystrix (Circuit Breaker)
● Ribbon (client side LB)
● Vert.x (reactive)
● Undertow (web server)
● Camel (integration)
● Hashicorp Consul (discovery)
● Swagger (service contracts)
● LogStash (log aggregation)
● and more...
@dandreadis
Self-contained (Uber) Jar
● bundles your application,
● the Fractions to support it,
● an internal Maven repository with
the dependencies,
● and Bootstrap code.
● There is also the notion of a
Hollow launch-pad type of jar.
@dandreadis
Fractions
● WildFly Swarm compositional units
● Focus on serving specific usecases
● Define dependencies to other Fractions
● Tie together
– Metadata
– WildFly subsystems
– MSC Services
– Modules
– Deployments
@dandreadis
Fractions layer on WildFly-Core and
● Enable WildFly subsystems (e.g. Infinispan)
● Integrate additional frameworks/services (e.g. Topology)
● Provide deployments (e.g. Swagger, Jolokia)
● Add API dependencies (e.g. JAX-RS)
● Alter deployments (e.g. SSO)
@dandreadis
Fractions (cont.)
● Expressed as Maven (GAV) coordinates:
– org.wildfly.swarm:<fraction>:<version>, e.g
– org.wildfly.swarm:undertow:2016.10.0
● 83 fractions currently available
– 48 stable
– 35 experimental
● About 50% wrap WildFly components
● More in the pipeline
@dandreadis
Where do I start?
http://wildfly-swarm.io/generator/
@dandreadis
@dandreadis
demo.zip (1kb)
├── pom.xml
└── src
└── main
└── java
└── com
└── example
└── demo
└── rest
└── HelloWorldEndpoint.java
@dandreadis
HelloWorldEndpoint.java
@dandreadis
How is WildFly Swarm enabled?
@dandreadis
Building / Running
● Build:
– mvn package
● Run:
– mvn wildfly-swarm:run
– java -jar demo-swarm.jar
– IDE > Run … MyMain
– IDE > Run o.w.s.Swarm
@dandreadis
@dandreadis
@dandreadis
demo-swarm.jar (9.3Mb)
...
_bootstrap/demo.war
m2repo/<fractions & modules jars>
modules/<bootstrap-modules.xml
<bootstrap-classes>
...
@dandreadis
Auto-detecting Fractions
● Absence of dependencies
triggers fractionDetectMode
● In this example JAXRS is
detected, leaving out Bean
Validation, CDI &
Transactions
● 4.3Mb jar
● 1330ms
boot time
@dandreadis
How Fractions are configured?
● Default configuration with sensible defaults
● System properties to override common settings
● standalone.xml or a fragment of it can override settings
● - or -
● Take control of main() and use the fluent Java API
– Covers all WildFly subsystems
– Generated from the WF configuration schema
@dandreadis
Taking control of main()
@dandreadis
Setup JDBC driver and Datasource
@dandreadis
Find out more…
wildfly-swarm.gitbooks.io/wildfly-swarm-users-guide/
@dandreadis
Who’s said Java EE
needs to be boring?
@dandreadis
Resources
● www.wildfly.org
● github.com/wildfly
● @wildflyAS
● wildfly.org/joinus
● wildfly-swarm.io
● github.com/wildfly-swarm
● @wildflyswarm
● irc: #wildfly-swarm
microprofile.io

More Related Content

WildFly & WildFly Swarm