1 / 51

Watching the logs roll by…

Watching the logs roll by…. Jevgeni Kabanov Founder of ZeroTurnaround Aranea and Squill Project Co-Founder Engineer , Scientist, Evangelist, Entrepreneur ,…. Turnaround cycle. Demo: SPRING petclinic turnaround. Outline. Turnaround – Why should you care?. Turnaround Cost.

uma
Download Presentation

Watching the logs roll by…

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Watching the logs roll by… Jevgeni Kabanov Founder of ZeroTurnaround Aranea and Squill Project Co-Founder Engineer, Scientist, Evangelist, Entrepreneur,…

  2. Turnaround cycle

  3. Demo: SPRING petclinic turnaround

  4. Outline

  5. Turnaround – Why should you care?

  6. Turnaround Cost

  7. Working Memory • Programming is an exercise of the working (short-term) memory that holds the current context • Questions: • How fast do you lose that context? • How much time does context recovery take?

  8. Working Memory Source: L. Peterson and M. Peterson “Short-Term Retention of Individual Verbal Items.” Journal of Experimental Psychology, 1959.

  9. Recovery time The recovery time after a phone call is at least 15 minutes. – Interrupts: Just a Minute Never Is, IEEE Software, 1998 The time it takes the employees to recover from an email interrupt was found to be on average 64 seconds. – Case Study: Evaluating the Effect of Email Interruptions within the Workplace, EASE 2002 The recovery time for an instant message was estimated to be between11 and 25 seconds – Instant Messaging Implications in the Transition from a Private Consumer Activity to a Communication Tool for Business, Software Quality Management, 2004

  10. Some Conclusions • With the recovery time considered, turnaround can easily cost more than 15% of coding time. • ~ 4.5 hours a week, 5 work weeks a year • Every second counts! There is a significant difference between a minute, 30, 15, 5 and 1 second pause!

  11. 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 – Hewlett-Packard Press Release, Abuse of technology can reduce UK workers' intelligence, 2005

  12. Trimming Builds

  13. A typical web application build

  14. Exploded layout • The project layout exactly follows the deployment layout • All resources are edited in-place without copying

  15. Automatic building • Classes should be compiled automatically by the IDE • The output should be set directly to WEB-INF/classes or similar

  16. Deployment by linking • The project is deployed by either pointing the container to it or creating a symbolic link in the deployment directory

  17. A typical web application build

  18. Bootstrapping Builds • Can’t always use exploded layout • Instead: • Build the WAR/EAR • Unzip it to a temp directory • Remove some of the folders/jars and symlink them to the project folders • Set the project to build automatically • Easy to automate with a bootstrapping script • Save on copying resources and packaging classes

  19. Reloading Code

  20. Reloading Code

  21. Reloading an Object OldClassLoader NewClassLoader MyObject.class MyObject.class Recreate the object MyObject MyObject

  22. Twin Class Loader Classes Objects and Code Classes Objects and Code Libraries Libraries OldClassLoader NewClassLoader JVM

  23. Twin Class Issues

  24. Web Deployment Serialize/deserialize init() Session Session Classes Sevlet NewClasses Sevlet App State App State Libraries New Libraries OldClassLoader NewClassLoader

  25. Web Deployment

  26. OSGi • Frameworks that implement the OSGi standard provide an environment for the modularization of applications into smaller bundles. [Wikipedia]

  27. OSGi Redeployment start() Classes Bundle NewClasses Bundle ModuleState ModuleState Libraries New Libraries OldClassLoader NewClassLoader

  28. OSGi

  29. Fine-grained Class Loaders • Wrap a class loader around components • Tapestry 5 • RIFE • Very fast reloading • Few classes at a time • Components managed by the framework are usually easy to recreate

  30. Component State Class Object NewClass NewObject Old ComponentClassLoader New Component ClassLoader

  31. Fine-grained Class Loaders

  32. Some Conclusions • Recreating the state is the breaking point of reloading a class • Coarse-grained class loaders take too much time to recreate the state • Fine-grained class loaders exhibit the twin class problem and are not universally applicable • Both are useful, but only partial solutions to the zero turnaround problem

  33. Dynamic Languages • Class-based languages have same limitations as Java • Groovy • Jython • Non-class based languages can have better support • JRuby • Clojure

  34. Hotswap and javarebel

  35. HotSwap User saves classfrom IDE OldClassLoader Debugger MyObject.class HotSwap Code 101000101 100010010 New Code 111000100 101010010 New Code 111000100 101010010 MyObject

  36. HotSwap

  37. JavaRebel Approach Classes Libraries Objects and Code ClassLoader ClassLoader ClassLoader Reloading “Interpreter” JavaRebel Agent JVM

  38. JavaRebel MyObject.class filechanged OldClassLoader MyObject.class JavaRebelagent Code 101000101 100010010 New Code 111000100 101010010 New Code 111000100 101010010 MyObject

  39. JavaRebel Features

  40. JavaRebel Installation • -noverify -javaagent:/path/to/javarebel.jar • Enables the JavaRebel agent • All *.class files in the classpath will be monitored for changes automatically • WAR/EAR deployment • rebel.xml configuration files

  41. DEMO: Petclinic With JavaRebel

  42. JavaRebel

  43. JavaRebel • Commercial tool, free 30 day trial • No free/open source analogs • Get it from:www.zeroturnaround.comor just google “javarebel” • Personal license: • Commercial license:

  44. JavaRebel History • JavaRebel • 1.0 released in December, 2007 • 2.0 in March, 2009 • Today over 10 000 licensed users • Some of our customers: • LinkedIn • Turner • Roche • Logica • United Health Group

  45. And beyond

  46. JavaRebel Classes MyObject.class filechanged Configuration changed OldClassLoader MyObject.class JavaRebelagent Code 101000101 100010010 New Code 111000100 101010010 Framework New Code 111000100 101010010 MyObject Configuration(XML, annotations, …)

  47. Types of Configuration

  48. JavaRebelPlugins

  49. DEMO: Petclinic With JavaRebel Spring plugin

  50. Take Away • 5-15% of your coding time is wasted on redeploy interruptions • Builds should be as slim as possible, symlink is your best friend • Code reloading is a complicated problem. • HotSwap, OSGi and framework support are the best partial solutions available for free

More Related