here - Transylvania JUG

advertisement
JBoss
Reloaded
Kabir Khan
Principal Software Engineer, JBoss by Red Hat
kkhan@redhat.com
@kabirkhan
Today’s sponsor:
Agenda
• The Road to Java EE 6 and JBoss AS 7
• Architecture Overview
• Management & Configuration
• Testing of EE apps
• Openshift
• EAP 6.0
A Brief History of JBoss AS
JavaEE 6 Full Profile
JBoss AS 7.1.0
JavaEE 6 Web Profile, JDK6
JBoss AS 7.0, 7.0.1, 7.0.2
Modular Service
Container
JavaEE 6 Web Profile, JDK6/JDK7
Modular Service Container Architecture
JBoss AS 6.0, 6.1
JBoss AS 5.1
JBoss AS 5: 5.0.0.GA, 5.0.1.GA
JBoss AS 4.2.0 – 4.2.3
JBoss AS 4.0.0
JBoss AS 3.2.0
–
– 4.0.5
JMX Microkernel
JBoss Versions
J2EE 1.4 certification
JDK 1.4
Microcontainer
JavaEE 5 certification, JDK5 & 6
MicroContainer Architecture
JEE 5.0 compatible,
not certified (95% pass)
JDK5.0
3.2.8
Time
2003
2004
2005
2006
J2EE 1.3, JDK 1.3
JMX MicroKernel Architecture
2007
2008
2009
2010
2011
2012
The Road To EE 6
“Create a fully Java EE 6 certified application server that starts
up in less than 5 seconds”
Main Requirements
• Smaller, faster and sexier
• Modular classloading/OSGi enabled
• Simplified user-focussed configuration
• Improved management
• Multi-node
• Java EE6 certified
AS 5 Great Foundation for EE6
But with AS 5...
• Not a good foundation to reach most of the goals
• Smaller, faster and sexier
• Microcontainer turned out to be slow
• Modular classloading/OSGi enabled
• Simplified user-focussed configuration + improved
management
• IOC only, no centralized configuration
• Multi-node
• Single node only
Engineering Response
• AS 7
• Total rewrite of core
• Andiamo
• AS 7 != AS 6 + 1
• AS 6.0
• Java EE 6 Web Profile certified
• Optimized 5.x architecture
• Community only
• EE 6 subsystems/profiles
Development Timeline
• Started Spring 2010
• AS 7.0 – released July 2011
• Java EE6 – Web Profile (+JCA, +JAX-RS) certified
• AS 7.0.1 – released Aug 2011
• MDB support, JSR-88, JPA w. older Hibernate 3
• AS 7.0.2 – released Sep 2011
• JSF 2.1, @Asynchronous, PicketLink SSO, etc.
• AS 7.1 – released Feb 2012
• Full Java EE6, Clustering, etc.
Architecture Overview
JBoss MSC
• Dependency injection and service lifecycle
• Microkernel/Microcontainer successor
• Highly concurrent and scalable
• Dependency resolution in parallel
• Low memory overhead
• UP/Down
• No reflection
• Eager / On Demand services
Modular Class Loading
a.jar
b.jar
?
a.v2
a.v1
c.jar
b.v1
d.jar
e.jar
c.v3
d.v1
Speed improvements
• JBoss MSC
• Concurrent service start
• Lazy loading of very heavy services
• Stax parser
• Avoids reflection and building up the parser (JAXB)
• Deployers
• Annotation indexing
• Reflection index
• JBoss Modules
• Faster class loading/resource lookup
Wow!
Boot-time comparisons
http://community.jboss.org/wiki/AS7StartupTimeShowdown
Memory consumption
Management & Configuration
User Focussed Configuration
• AS 5 + 6 - lots of -beans.xml
• No overall model
<bean name="TransactionManager" class="com.arjuna.ats.jbossatx.jta.TransactionManagerService">
<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=TransactionManager",
exposedInterface=com.arjuna.ats.jbossatx.jta.TransactionManagerServiceMBean.class, registerDirectly=true)</annotation>
<annotation>@org.jboss.managed.api.annotation.ManagementObject(name="TransactionManager",componentType=@org.jb
oss.managed.api.annotation.ManagementComponent(type = "MCBean", subtype =
"JTA"),targetInterface=com.arjuna.ats.jbossatx.jta.TransactionManagerServiceMBean.class)
</annotation>
<property name="transactionTimeout">300</property>
<property name="objectStoreDir">${jboss.server.data.dir}/tx-object-store</property>
•$JBOSS_HOME/standalone/configuration/standalone.xml
<subsystem xmlns="urn:jboss:domain:transactions:1.0">
<recovery-environment socket-binding="txn-recovery-environment"
status-socket-binding="txn-status-manager"/>
<core-environment socket-binding="txn-socket-process-id"/>
</subsystem>
Standalone.xml Main Elements
<?xml version='1.0' encoding='UTF-8'?>
<server xmlns="urn:jboss:domain:1.1">
<management>
<security-realms>
<security-realm name="ManagementRealm">
<authentication>
<properties path="mgmt-users.properties" relative-to="jboss.server.config.dir"/>
</authentication>
</security-realm>
</security-realms>
<management-interfaces>
<native-interface security-realm="ManagementRealm">
<socket-binding native="management-native"/>
</native-interface>
<http-interface security-realm="ManagementRealm">
<socket-binding http="management-http"/>
</http-interface>
</management-interfaces>
</management>
<interfaces>
<interface name="management">
<inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
System properties
</interface>
<interface name="public">
<inet-address value="${jboss.bind.address:127.0.0.1}"/>
</interface>
</interfaces>
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.portoffset:0}">
<socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9999}"/>
<socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
<socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9443}"/>
</socket-binding-group>
</server>
Standalone.xml Main Elements
<server xmlns="urn:jboss:domain:1.1">
META-INF/services/org.jboss.as.controller.Extension:
<extensions>
org.jboss.as.mail.extension.MailExtension
<extension module="org.jboss.as.mail"/>
</extensions>
<profile>
Parser for namespace initialized by
<subsystem xmlns="urn:jboss:domain:mail:1.0">
MailExtension
<mail-session jndi-name="java:jboss/mail/Default">
<smtp-server outbound-socket-binding-ref="mail-smtp"/>
</mail-session>
</subsystem>
</profile>
<interfaces>
<interface name="public">
<inet-address value="${jboss.bind.address:127.0.0.1}"/>
</interface>
</interfaces>
<socket-binding-group name="standard-sockets"
default-interface="public"
port-offset="${jboss.socket.binding.port-offset:0}">
<outbound-socket-binding name="mail-smtp">
<remote-destination host="localhost" port="25"/>
</outbound-socket-binding>
</socket-binding-group>
</server>
Model - JBoss DMR
• A detyped representation of model
• Resources with children and/or simple attributes
• Simple types: String, int, boolean etc.
• Operations to add/remove/manipulate resources
• Change model
• Runtime: Start/stop services
• Self describing
• Convertible to/from JSON
XML Maps to model
<subsystem xmlns="urn:jboss:domain:mail:1.0">
<mail-session jndi-name="java:jboss/mail/Default">
<smtp-server outbound-socket-binding-ref="mail-smtp"/>
</mail-session>
</subsystem>
"mail-session" => {"java:jboss/mail/Default" => {
"debug" => false,
"from" => undefined,
"jndi-name" => "java:jboss/mail/Default",
"server" => {"smtp" => {
"outbound-socket-binding-ref" => "mail-smtp",
"password" => undefined,
"ssl" => false,
"username" => undefined
}}
}
Unified Management
Java Clients
Model
Services
Services
Remote Java API
Java API
(Controller)
HTTP API
CLI
XML
Console
Shell script
Script Clients
2 Main Modes
• Standalone Mode
• A single self-managed server
• standalone/configuration/standalone.xml
• Domain Mode
• Centralized configuration for several hosts
• Each host may have several server
• One entry point for management
Domain Mode
ServerGroup != Cluster
Domain config
domain.xml contains profiles
<domain xmlns="urn:jboss:domain:1.1">
...
<profiles>
<profile name="default">
<subsystem xmlns="urn:jboss:domain:logging:1.1">
...
</profile>
<profile name="ha">
<subsystem xmlns="urn:jboss:domain:jgroups:1.0"
default-stack="udp">
...
</profile>
</profiles>
<server-groups>
<server-group name="main-server-group" profile="default">
<jvm name="default">
<heap size="64m" max-size="512m"/>
</jvm>
<socket-binding-group ref="standard-sockets"/>
</server-group>
<server-group name="other-server-group" profile="ha">
...
</server-group>
</server-groups>
</domain>
host.xml maps profiles to servers
<host xmlns="urn:jboss:domain:1.1" name="master">
<domain-controller>
<local/>
<!-- <remote host="192.168.100.1" port="9999"/> -->
</domain-controller>
<jvms>
<jvm name="default">
<heap size="64m" max-size="128m"/>
</jvm>
</jvms>
....
<servers>
<server name="server-one" group="main-server-group">
<jvm name="default"/>
</server>
<server name="server-two" group="main-server-group"
auto-start="true">
<socket-binding-group ref="standard-sockets"
port-offset="100"/>
<jvm name="default"/>
</server>
</servers>
</host>
Arquillian
Testable EE!
Arquillian
• Micro deployments created and deployed
• Test class
• In container
• On client
• Adapters for several target containers
• JBoss 7, JBoss 6, Tomcat, etc.
• Embedded/Managed/Remote
• JUnit/TestNG
OpenShift
AS7 in the cloud
OpenShift
• Deploy apps in cloud
• PHP
• Ruby (TorqueBox)
• Java EE
• Express
• Free!
• Flex
• More control over EC2 instances
• Will be supported in future
JBoss EAP
Professional Support
JBoss AS vs JBoss EAP
• JBoss AS
• Community project
• Bleeding edge innovation
• JBoss Enterprise Application Platform
• Supported for 4 + 3 years
• Forked from stable AS version
• Cumulative patch updates
• Rigorously tested (performance, scalability, SpecJ etc.)
JBoss AS vs EAP
Roundup
• Rewritten core
• Persistent simplified configuration
• Improved management
• Standalone vs domain mode
• Fast!
• EE6 from first class components
• Arquillian for testing
• Supported EAP 6 later this year
• OpenShift
Important Links
• www.jboss.org/as7
• Forums, documentation, download etc.
• www.github.com/jbossas
• /jboss-as
• /quickstart
• http://openshift.redhat.com/ (cloud)
• http://www.jboss.org/aerogear (html5/mobile)
• http://www.jboss.org/arquillian (testing)
Download