Zero Turnaround in JavaWatching the logs roll by…<br />Jevgeni KabanovFounder of ZeroTurnaround<br />Aranea and Squill Pro...
Turnaround cycle<br />
Demo: SPRING petclinic turnaround<br />
Outline<br />
Turnaround – Why should you care?<br />
Turnaround Cost<br />
Working Memory<br />Programming is an exercise of the working (short-term) memory that holds the current context<br />Ques...
Working Memory<br />Source: L. Peterson and M. Peterson “Short-Term Retention of Individual Verbal Items.” Journal of Expe...
Recovery time<br />The recovery time after a phone call is at least 15 minutes. <br />–  Interrupts: Just a Minute Never I...
Some Conclusions<br />With the recovery time considered, turnaround can easily cost more than 15% of coding time.<br /><ul...
Frustration<br />a user experiences a greater increase in anxiety when a peripheral task interrupts her primary task than ...
Worker’s IQ falls 10 points when distracted. This drop in IQ is more than double the drop seen after smoking marijuana. IQ...
Trimming Builds<br />
A typical web application build<br />
Exploded layout<br />The project layout exactly follows the deployment layout<br />All resources are edited in-place witho...
Automatic building<br />Classes should be compiled automatically by the IDE<br />The output should be set directly to WEB-...
Deployment by linking<br />The project is deployed by either pointing the container to it or creating a symbolic link in t...
A typical web application build<br />
Bootstrapping Builds<br />Can’t always use exploded layout<br />Instead:<br />Build the WAR/EAR<br />Unzip it to a temp di...
Reloading Code<br />
Reloading Code<br />
Reloading an Object<br />OldClassLoader<br />NewClassLoader<br />MyObject.class<br />MyObject.class<br />Recreate the obje...
Twin Class Loader<br />Classes<br />Objects and Code<br />Classes<br />Objects and Code<br />Libraries<br />Libraries<br /...
Twin Class Issues<br />
Web Deployment<br />Serialize/deserialize<br />init()<br />Session<br />Session<br />Classes<br />Sevlet<br />NewClasses<b...
Web Deployment<br />
OSGi<br />Frameworks that implement the OSGi standard provide an environment for the modularization of applications into s...
OSGi Redeployment<br />start()<br />Classes<br />Bundle<br />NewClasses<br />Bundle<br />ModuleState<br />ModuleState<br /...
OSGi<br />
Fine-grained Class Loaders<br />Wrap a class loader around components<br />Tapestry 5<br />RIFE<br />Very fast reloading<b...
Component State<br />Class<br />Object<br />NewClass<br />NewObject<br />Old ComponentClassLoader<br />New Component Class...
Fine-grained Class Loaders<br />
Some Conclusions<br />Recreating the state is the breaking point of reloading a class<br />Coarse-grained class loaders ta...
Dynamic Languages<br />Class-based languages have same limitations as Java<br />Groovy<br />Jython<br />Non-class based la...
Hotswap and javarebel<br />
HotSwap<br />User saves classfrom IDE<br />OldClassLoader<br />Debugger<br />MyObject.class<br />HotSwap<br />Code 1010001...
HotSwap<br />
JavaRebel Approach<br />Classes<br />Libraries<br />Objects and Code<br />ClassLoader<br />ClassLoader<br />ClassLoader<br...
JavaRebel<br />MyObject.class filechanged<br />OldClassLoader<br />MyObject.class<br />JavaRebelagent<br />Code 101000101<...
JavaRebel Features<br />
JavaRebel Installation<br />-noverify -javaagent:/path/to/javarebel.jar<br />Enables the JavaRebel agent<br />All *.class ...
DEMO: Petclinic With JavaRebel<br />
JavaRebel<br />
JavaRebel<br />Commercial tool, free 30 day trial<br />No free/open source analogs<br />Get it from:www.zeroturnaround.com...
JavaRebel History<br />JavaRebel 1.0 released in December, 2007<br />Today over 10 000 licensed users <br />Some of our cu...
And beyond<br />
Classes<br />JavaRebel<br />MyObject.class filechanged<br />Configuration changed<br />OldClassLoader<br />MyObject.class<...
Types of Configuration<br />
JavaRebelPlugins<br />
DEMO: Petclinic With JavaRebel Spring plugin<br />
JavaRebel 2.0<br />
Take Away<br />Every next second spent on turnaround costs more!<br />Builds should be as slim as possible, symlink is you...
Upcoming SlideShare
Loading in …5
×

Zero Turnaround in Java

1,231 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,231
On SlideShare
0
From Embeds
0
Number of Embeds
9
Actions
Shares
0
Downloads
25
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Zero Turnaround in Java

  1. 1. Zero Turnaround in JavaWatching the logs roll by…<br />Jevgeni KabanovFounder of ZeroTurnaround<br />Aranea and Squill Project Co-Founder<br />Speaker, Scientist, Engineer, Entrepreneur,…<br />
  2. 2. Turnaround cycle<br />
  3. 3. Demo: SPRING petclinic turnaround<br />
  4. 4. Outline<br />
  5. 5. Turnaround – Why should you care?<br />
  6. 6. Turnaround Cost<br />
  7. 7. Working Memory<br />Programming is an exercise of the working (short-term) memory that holds the current context<br />Questions:<br />How fast do you lose that context?<br />How much time does context recovery take?<br />
  8. 8. Working Memory<br />Source: L. Peterson and M. Peterson “Short-Term Retention of Individual Verbal Items.” Journal of Experimental Psychology, 1959.<br />
  9. 9. Recovery time<br />The recovery time after a phone call is at least 15 minutes. <br />– Interrupts: Just a Minute Never Is, IEEE Software, 1998<br />The time it takes the employees to recover from an email interrupt was found to be on average 64 seconds.<br />– Case Study: Evaluating the Effect of Email Interruptions within the Workplace, EASE 2002 <br />The recovery time for an instant message was estimated to be between11 and 25 seconds<br />– Instant Messaging Implications in the Transition from a Private Consumer Activity to a Communication Tool for Business, Software Quality Management, 2004<br />
  10. 10. Some Conclusions<br />With the recovery time considered, turnaround can easily cost more than 15% of coding time.<br /><ul><li>~ 4.5 hours a week, 5 work weeks a year</li></ul>Every second counts! There is a significant difference between a minute, 30, 15, 5 and 1 second pause!<br />
  11. 11. Frustration<br />a user experiences a greater increase in anxiety when a peripheral task interrupts her primary task than when it does not<br />a user perceives an interruptedtask to be more difficult to complete than a non-interrupted task<br />– The Effects of Interruptions on Task Performance, Annoyance, and Anxiety in the User Interface, IEEE Computer, 2006<br />Many programmers appear to be continually frustrated in attempts to work. The so-called "work -day" is made up largely of frustration time.<br />– Programmer performance and the effects of the workplace, ICSE 1985<br />
  12. 12. Worker’s IQ falls 10 points when distracted. This drop in IQ is more than double the drop seen after smoking marijuana. IQ drop of 10 points is equivalent to missing an entire night of sleep<br />– Hewlett-Packard Press Release, Abuse of <br />technology can reduce UK workers' intelligence, <br />2005<br />
  13. 13. Trimming Builds<br />
  14. 14. A typical web application build<br />
  15. 15. Exploded layout<br />The project layout exactly follows the deployment layout<br />All resources are edited in-place without copying<br />
  16. 16. Automatic building<br />Classes should be compiled automatically by the IDE<br />The output should be set directly to WEB-INF/classes or similar<br />
  17. 17. Deployment by linking<br />The project is deployed by either pointing the container to it or creating a symbolic link in the deployment directory<br />
  18. 18. A typical web application build<br />
  19. 19. Bootstrapping Builds<br />Can’t always use exploded layout<br />Instead:<br />Build the WAR/EAR<br />Unzip it to a temp directory<br />Remove some of the folders/jars and symlink them to the project folders<br />Set the project to build automatically<br />Easy to automate with a bootstrapping script<br />Save on copying resources and packaging classes<br />
  20. 20. Reloading Code<br />
  21. 21. Reloading Code<br />
  22. 22. Reloading an Object<br />OldClassLoader<br />NewClassLoader<br />MyObject.class<br />MyObject.class<br />Recreate the object<br />MyObject<br />MyObject<br />
  23. 23. Twin Class Loader<br />Classes<br />Objects and Code<br />Classes<br />Objects and Code<br />Libraries<br />Libraries<br />OldClassLoader<br />NewClassLoader<br />JVM<br />
  24. 24. Twin Class Issues<br />
  25. 25. Web Deployment<br />Serialize/deserialize<br />init()<br />Session<br />Session<br />Classes<br />Sevlet<br />NewClasses<br />Sevlet<br />App State<br />App State<br />Libraries<br />New Libraries<br />OldClassLoader<br />NewClassLoader<br />
  26. 26. Web Deployment<br />
  27. 27. OSGi<br />Frameworks that implement the OSGi standard provide an environment for the modularization of applications into smaller bundles. [Wikipedia]<br />
  28. 28. OSGi Redeployment<br />start()<br />Classes<br />Bundle<br />NewClasses<br />Bundle<br />ModuleState<br />ModuleState<br />Libraries<br />New Libraries<br />OldClassLoader<br />NewClassLoader<br />
  29. 29. OSGi<br />
  30. 30. Fine-grained Class Loaders<br />Wrap a class loader around components<br />Tapestry 5<br />RIFE<br />Very fast reloading<br />Few classes at a time<br />Components managed by the framework are usually easy to recreate<br />
  31. 31. Component State<br />Class<br />Object<br />NewClass<br />NewObject<br />Old ComponentClassLoader<br />New Component ClassLoader<br />
  32. 32. Fine-grained Class Loaders<br />
  33. 33. Some Conclusions<br />Recreating the state is the breaking point of reloading a class<br />Coarse-grained class loaders take too much time to recreate the state<br />Fine-grained class loaders exhibit the twin class problem and are not universally applicable<br />Both are useful, but only partial solutions to the zero turnaround problem<br />
  34. 34. Dynamic Languages<br />Class-based languages have same limitations as Java<br />Groovy<br />Jython<br />Non-class based languages can have better support<br />JRuby<br />Clojure<br />
  35. 35. Hotswap and javarebel<br />
  36. 36. HotSwap<br />User saves classfrom IDE<br />OldClassLoader<br />Debugger<br />MyObject.class<br />HotSwap<br />Code 101000101<br />100010010<br />New Code 111000100<br />101010010<br />New Code 111000100<br />101010010<br />MyObject<br />
  37. 37. HotSwap<br />
  38. 38. JavaRebel Approach<br />Classes<br />Libraries<br />Objects and Code<br />ClassLoader<br />ClassLoader<br />ClassLoader<br />Reloading “Interpreter”<br />JavaRebel<br />Agent<br />JVM<br />
  39. 39. JavaRebel<br />MyObject.class filechanged<br />OldClassLoader<br />MyObject.class<br />JavaRebelagent<br />Code 101000101<br />100010010<br />New Code 111000100<br />101010010<br />New Code 111000100<br />101010010<br />MyObject<br />
  40. 40. JavaRebel Features<br />
  41. 41. JavaRebel Installation<br />-noverify -javaagent:/path/to/javarebel.jar<br />Enables the JavaRebel agent<br />All *.class files in the classpath will be monitored for changes automatically<br />(Optional) -Drebel.dirs=folder1,folder2,…<br />Specifies IDE output folders or just class folders<br />Can deploy a WAR/EAR and still get instant updates to code<br />
  42. 42. DEMO: Petclinic With JavaRebel<br />
  43. 43. JavaRebel<br />
  44. 44. JavaRebel<br />Commercial tool, free 30 day trial<br />No free/open source analogs<br />Get it from:www.zeroturnaround.comor just google “javarebel”<br />Personal license:<br />Commercial license:<br />~ $10<br />
  45. 45. JavaRebel History<br />JavaRebel 1.0 released in December, 2007<br />Today over 10 000 licensed users <br />Some of our customers:<br />LinkedIn<br />Turner<br />Roche<br />Logica<br />Disney.com <br />
  46. 46. And beyond<br />
  47. 47. Classes<br />JavaRebel<br />MyObject.class filechanged<br />Configuration changed<br />OldClassLoader<br />MyObject.class<br />JavaRebelagent<br />Code 101000101<br />100010010<br />New Code 111000100<br />101010010<br />Framework<br />New Code 111000100<br />101010010<br />MyObject<br />Configuration(XML, annotations, …)<br />
  48. 48. Types of Configuration<br />
  49. 49. JavaRebelPlugins<br />
  50. 50. DEMO: Petclinic With JavaRebel Spring plugin<br />
  51. 51. JavaRebel 2.0<br />
  52. 52. Take Away<br />Every next second spent on turnaround costs more!<br />Builds should be as slim as possible, symlink is your best friend<br />Code reloading is a complicated problem with HotSwap, OSGi and framework support being the best partial solutions available for free<br />JavaRebel solves the turnaround problem for peanuts :)<br />

×