Monitoring and                          Feature Toggle Pattern                                with JMX                    ...
Speaker                          @cyrilleleclerc                          blog.xebia.fr                               Cyri...
The use case                                         3Thursday, June 16, 2011
The Use Case                                         Corporate Data Center                          travel-ecommerce      ...
The Use Case xebia-spring-travel source code      ▶   http://xebia-france.googlecode.com/svn/training/xebia-spring-travel...
Part 1                          Monitoring with JMX                                                6Thursday, June 16, 2011
Simplified Use Case                                                7Thursday, June 16, 2011
Simplified Use Case                                    Corporate Data Center                                 travel-ecomme...
Simplified Use Case                                    Corporate Data Center                                 travel-ecomme...
Custom/business indicator monitoring                                      with JMX                                        ...
Custom Indicator Monitoring with JMX                                                 CreditCardService                    ...
Custom Indicator Monitoring with JMX@ManagedResourcepublic class CreditCardServiceMonitoringImpl implements CreditCardServ...
Accessing JMX is not so difficult                                                              13Thursday, June 16, 2011
JMX Monitoring with Visual VM                                14Thursday, June 16, 2011
JMX Monitoring with JSP Pages                          Powered by JMX ! Human friendly or script friendly pages Beware o...
Graphite - JMXTrans Style Reporting Tools {     "servers" : [ {       "port" : "6969",       "host" : "my-server-1",      ...
Monotoring systems                              AppDynamics                    Hyperic                              All ot...
JVM Based Scripting Language                          http://code.google.com/p/xebia-france/source/browse/training/xebia-s...
Part 2                          Feature Toggle Pattern with JMX                                                           ...
Simplified Use Case                                                20Thursday, June 16, 2011
Simplified Use Case                                         Corporate Data Center                          travel-ecommerc...
What ? Why ?                                         22Thursday, June 16, 2011
What is it ? Technique to enable/disable a feature without    redeploying Can be simple : on/off Can be sophisticated :...
Benefits of the Feature Toggle Pattern Dissociate deployment & feature activation Progressive activation of a feature   ...
Coding Patterns                                            25Thursday, June 16, 2011
Coding PatternsDispatcher                                                       AntiFraudService                          ...
Coding PatternsTo duplicate or not to duplicate ?                      Dispatching                               Smart reu...
Coding PatternsTo duplicate or not to duplicate ?                   Dispatching                               Smart reuse ...
Coding PatternsTo duplicate or not to duplicate ?                   Dispatching                               Smart reuse ...
Coding PatternsTo duplicate or not to duplicate ?                          Old version removal requires cleanup           ...
Coding PatternsTo duplicate or not to duplicate ?       Old code removal is simpler with brutal duplication               ...
Demo                                 32Thursday, June 16, 2011
Questions / Answers                          ?                              33Thursday, June 16, 2011
Upcoming SlideShare
Loading in...5
×

Paris Devops - Monitoring And Feature Toggle Pattern With JMX

4,058

Published on

Monitoring and Feature Toggle Pattern with JMX @ Paris Devops Meetup

Published in: Technology

Paris Devops - Monitoring And Feature Toggle Pattern With JMX

  1. 1. Monitoring and Feature Toggle Pattern with JMX Bruno Bonfils Cyrille Le Clerc 15/06/2011Thursday, June 16, 2011
  2. 2. Speaker @cyrilleleclerc blog.xebia.fr Cyrille Le Clerc Large Scale In Memory Data Grid Open Source (Apache CXF, ...) “you build it, you run it” 2Thursday, June 16, 2011
  3. 3. The use case 3Thursday, June 16, 2011
  4. 4. The Use Case Corporate Data Center travel-ecommerce anti-fraud Tomcat Tomcat travel-ecommerce anti-fraud Tomcat Tomcat Credit Card Service Travel e-commerce application 4Thursday, June 16, 2011
  5. 5. The Use Case xebia-spring-travel source code ▶ http://xebia-france.googlecode.com/svn/training/xebia-spring-travel/tags/xebia-spring-travel-1.0.0/ ▶ Groovy JMX scripts » http://xebia-france.googlecode.com/svn/training/xebia-spring-travel/tags/xebia-spring-travel-1.0.0/xebia-spring-travel- ecommerce/src/main/scripts/ ▶ JMXTrans Configuration » http://xebia-france.googlecode.com/svn/training/xebia-spring-travel/tags/xebia-spring-travel-1.0.0/xebia-spring-travel- ecommerce/src/main/jmxtrans/ ▶ JMeter plan » http://xebia-france.googlecode.com/svn/training/xebia-spring-travel/tags/xebia-spring-travel-1.0.0/xebia-spring-travel- ecommerce/src/main/jmeter/ xebia-management-extras JMX library ▶ http://code.google.com/p/xebia-france/wiki/XebiaManagementExtras 5Thursday, June 16, 2011
  6. 6. Part 1 Monitoring with JMX 6Thursday, June 16, 2011
  7. 7. Simplified Use Case 7Thursday, June 16, 2011
  8. 8. Simplified Use Case Corporate Data Center travel-ecommerce Tomcat Credit Card Service Mock Monitoring Booking and Credit Card Service 8Thursday, June 16, 2011
  9. 9. Simplified Use Case Corporate Data Center travel-ecommerce Tomcat Credit Card Service Mock Monitoring Booking and Credit Card Service 9Thursday, June 16, 2011
  10. 10. Custom/business indicator monitoring with JMX 10Thursday, June 16, 2011
  11. 11. Custom Indicator Monitoring with JMX CreditCardService #purchase() CreditCardService MonitoringImpl CreditCardServiceImpl #purchase() #purchase() monitoring logic isolated with a delegate pattern 11Thursday, June 16, 2011
  12. 12. Custom Indicator Monitoring with JMX@ManagedResourcepublic class CreditCardServiceMonitoringImpl implements CreditCardService { // delegate private CreditCardService creditCardService; // counters private final AtomicInteger purchaseInvocationCounter = new AtomicInteger(); private final AtomicLong purchaseInvocationDurationInNanosCounter = new AtomicLong(); private final AtomicInteger threeDSecureVerificationExceptionCounter = new AtomicInteger(); @Override public PaymentTransaction purchase(MonetaryAmount total, Order order, String requestId) { long nanosBefore = System.nanoTime(); try { return creditCardService.purchase(total, order, requestId); } catch (ThreeDSecureVerificationException e) { threeDSecureVerificationExceptionCounter.incrementAndGet(); throw e; } finally { purchaseInvocationCounter.incrementAndGet(); purchaseInvocationDurationInNanosCounter.addAndGet(System.nanoTime() - nanosBefore); } } http://code.google.com/p/xebia-france/source/browse/training/xebia-spring-travel/tags/xebia-spring-travel-1.0.0/xebia-spring-travel-ecommerce/src/main/java/fr/ xebia/monitoring/demo/payment/CreditCardServiceMonitoringImpl.java 12Thursday, June 16, 2011
  13. 13. Accessing JMX is not so difficult 13Thursday, June 16, 2011
  14. 14. JMX Monitoring with Visual VM 14Thursday, June 16, 2011
  15. 15. JMX Monitoring with JSP Pages Powered by JMX ! Human friendly or script friendly pages Beware of security ▶ BasicAuth ▶ Obfuscated URL : /my-app/seye5E7E/jmx/cxf.jsp 15Thursday, June 16, 2011
  16. 16. Graphite - JMXTrans Style Reporting Tools { "servers" : [ { "port" : "6969", "host" : "my-server-1", "alias" : "travel-ecommerce-1", "queries" : [ { "outputWriters" : [ { "@class" : "com.googlecode.jmxtrans.model.output.GraphiteWriter", "settings" : { "port" : 2003, "host" : "graphite-server" } }], "obj": "travel-ecommerce:name=CreditCardServiceMonitoringImpl,...", Graphite "resultAlias" : "CreditCardService", "attr":["PurchaseInvocationCount", "ThreeDSecureVerificationExceptionCount", ...] } ], "numQueryThreads" : 2 JMX Trans Configuration } ] } http://code.google.com/p/xebia-france/source/browse/training/xebia-spring-travel/tags/xebia-spring-travel-1.0.0/xebia-spring-travel- ecommerce/src/main/jmxtrans/xebia-spring-travel-ecommerce-jmxtrans.json 16Thursday, June 16, 2011
  17. 17. Monotoring systems AppDynamics Hyperic All others ... 17Thursday, June 16, 2011
  18. 18. JVM Based Scripting Language http://code.google.com/p/xebia-france/source/browse/training/xebia-spring-travel/tags/xebia-spring- travel-1.0.0/xebia-spring-travel-ecommerce/src/main/scripts/getAntiFraudVerificationStatus.groovy 18Thursday, June 16, 2011
  19. 19. Part 2 Feature Toggle Pattern with JMX 19Thursday, June 16, 2011
  20. 20. Simplified Use Case 20Thursday, June 16, 2011
  21. 21. Simplified Use Case Corporate Data Center travel-ecommerce anti-fraud Tomcat Tomcat Credit Card Service Enable anti-fraud 21Thursday, June 16, 2011
  22. 22. What ? Why ? 22Thursday, June 16, 2011
  23. 23. What is it ? Technique to enable/disable a feature without redeploying Can be simple : on/off Can be sophisticated : f(user), f(server), etc 23Thursday, June 16, 2011
  24. 24. Benefits of the Feature Toggle Pattern Dissociate deployment & feature activation Progressive activation of a feature Canary Testing Measure impacts of a new version A/B Testing Differ feature activation on production Trunk based development 24Thursday, June 16, 2011
  25. 25. Coding Patterns 25Thursday, June 16, 2011
  26. 26. Coding PatternsDispatcher AntiFraudService <<Interface>> AntiFraudServiceV1Impl AntiFraudService DispatchingImpl AntiFraudServiceV2Impl JMX transient persistent The dispatcher holds the feature toggle http://code.google.com/p/xebia-france/source/browse/training/xebia-spring-travel/tags/xebia-spring- travel-1.0.0/xebia-spring-travel-ecommerce/src/main/java/fr/xebia/ws/travel/antifraud/v1_0/ AntiFraudServiceDispatchingImpl.java 26Thursday, June 16, 2011
  27. 27. Coding PatternsTo duplicate or not to duplicate ? Dispatching Smart reuse and mutualization Dispatching Brutal duplication Version 1 Version 2 27Thursday, June 16, 2011
  28. 28. Coding PatternsTo duplicate or not to duplicate ? Dispatching Smart reuse and mutualization Dispatching Brutal duplication Version 1 Version 2 28Thursday, June 16, 2011
  29. 29. Coding PatternsTo duplicate or not to duplicate ? Dispatching Smart reuse and mutualization Dispatching Brutal duplication Version 1 Version 2 29Thursday, June 16, 2011
  30. 30. Coding PatternsTo duplicate or not to duplicate ? Old version removal requires cleanup Smart reuse and mutualization Old version removal is clean Brutal duplication Version 1 Version 2 30Thursday, June 16, 2011
  31. 31. Coding PatternsTo duplicate or not to duplicate ? Old code removal is simpler with brutal duplication 31Thursday, June 16, 2011
  32. 32. Demo 32Thursday, June 16, 2011
  33. 33. Questions / Answers ? 33Thursday, June 16, 2011
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×