Upload
neueda
View
603
Download
0
Tags:
Embed Size (px)
Citation preview
Why Doesn’t Java
Have Instant
Turnaround?
Anton Arhipov
@antonarhipov
Product Lead at ZeroTurnaround
twitter.com/ekabanov
twitter.com/ekabanov
Turnaround cycle
Make a change
Build, deploy,
wait
Check the
change
twitter.com/ekabanov
What about others?
twitter.com/ekabanov
Why Java is heavier than others?
Dev << Prod
Operations
Standards
Vendors
twitter.com/ekabanov
A typical web application build
Package everything in a WAR/EAR
Package modules in JARs
Compile classes
Copy static resources
Resolve dependencies
twitter.com/ekabanov
Exploded layout
twitter.com/ekabanov
Automatic building
twitter.com/ekabanov
Deployment by linking
• ln -s
• Symlinks can point to any file
Linux symbolic links
• Sysinternals junction utility on NTFS partitions, included in Windows 7
• Can only link to local directories and must be careful when deleting
Windows symbolic links
twitter.com/ekabanov
Help!
is downloading the internets!
2008 => 2011
twitter.com/ekabanov
2008 => 2011
this works:
mvn jetty:run
others?
twitter.com/ekabanov
App Server
getResource(“hello.html”)
Workspace
read(“src/main/.../hello.html”)
twitter.com/ekabanov
A typical web application build
Package everything in a WAR/EAR
Package modules in JARs
Compile classes
Copy static resources
Resolve dependencies
twitter.com/ekabanov
Why code reloading is so hard?
Externalized Temporary
Serializable Derivative
State
twitter.com/ekabanov
Reloading an Object
MyObject
MyObject.class
OldClassLoader NewClassLoader
MyObject.class
MyObject Recreate the object
twitter.com/ekabanov
Web Deployment
Classes
Libraries
OldClassLoader NewClassLoader
Sevlet New
Classes
New
Libraries
Sevlet
Session Session
init()
App
State
App
State
Serialize/deserialize
twitter.com/ekabanov
Twin ClassLoader Issues
JVM
Classes
Libraries
OldClassLoader NewClassLoader
Objects
and Code
Classes
Libraries
Objects
and Code
OutOfMemoryError
ClassCastException
…
twitter.com/ekabanov
2008 => 2011
twitter.com/ekabanov
Frameworks
twitter.com/ekabanov
2008 => 2011
twitter.com/ekabanov
Old Component
ClassLoader
New Component
ClassLoader
Class Object
Component State
New
Class
New
Object
twitter.com/ekabanov
JVM Languages
Class-based
languages have same
limitations as Java
Groovy
Jython
Non-class based
languages can have
better support
JRuby
Clojure
twitter.com/ekabanov
HotSwap
MyObject
MyObject.class
OldClassLoader
Code
101000101 100010010
Debugger
HotSwap
New Code
111000100 101010010
New Code
111000100 101010010
User saves class
from IDE
twitter.com/ekabanov
JRebel Class Reloading HotSwap JRebel
Changing method bodies + +
Adding/removing methods - +
Adding/removing constructors - +
Adding/removing fields - +
Adding/removing classes - +
Adding/removing annotations - +
Replacing superclass - -
Adding/removing
implemented interfaces - -
twitter.com/ekabanov
JRebel
MyObject
MyObject.class
OldClassLoader
Code
101000101 100010010 New Code
111000100 101010010
New Code
111000100 101010010
JRebel
agent
MyObject.class file
changed
twitter.com/ekabanov
Classes
JRebel
MyObject
MyObject.class
OldClassLoader
Code
101000101 100010010 New Code
111000100 101010010
New Code
111000100 101010010
JRebel
agent
MyObject.class file
changed
Configuration
(XML, annotations, …)
Fra
me
wo
rk
Configuration changed
twitter.com/ekabanov
IDEs Containers Frameworks
Build Tools
JRebel Integration
twitter.com/ekabanov
Who is already using JRebel? Air / Auto Banking & FSI Web IT Telco
Healthcare
Consulting Fashion/Entertain
ment
Over 40 million builds, redeploys & restarts
prevented for 20,000+ Java developers
(how awesome is that?)
twitter.com/ekabanov
twitter.com/ekabanov
<container-descriptor>
<fast-swap>true</fast-swap>
</container-descriptor>
weblogic-application.xml
Oracle Weblogic FastSwap
twitter.com/ekabanov
Q: Why Doesn’t Java Have
Instant Turnaround?
A1: Other languages/platforms aren’t
much better!
A2: Reloading code is easy, preserving
state is hard!
A3: It’s better than it used to be!
A4: Play!, Tapestry 5 and Grails do that!
A5: But what about JRebel?
twitter.com/ekabanov
Q?
twitter.com/ekabanov
And also…
Instant, online rollout and rollback of
changes to production Java EE apps
for any deployment size.