Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Migrating The Monolith

Rohit Kelapure
September 17, 2015

Migrating The Monolith

Overview of the technology constraints of putting classic and legacy applications on the cloud. This slide deck covers tools and prescriptive quantitative techniques and the why what and how of migrating applications to Cloud Foundry PaaS.

Rohit Kelapure

September 17, 2015
Tweet

More Decks by Rohit Kelapure

Other Decks in Technology

Transcript

  1. SPRINGONE2GX WASHINGTON, DC Unless otherwise indicated, these slides are ©

    2013-2015 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Migrating the Monolith Rohit Kelapure @rkela
  2. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ MONOLITHS : THE JOURNEY 2
  3. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Monolith – Big Ball Of Mud
  4. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Monoliths in the Wild – Liferay Portal
  5. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Kiviat Metrics Graphs 5 https://github.com/pivotalservices/spring-music http://www.campwoodsw.com/sourcemonitor.html
  6. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ How The Hell Did We Get Here ? THROWAWAY CODE (QUICK HACK, KLEENEX CODE, DISPOSABLE CODE, SCRIPTING, KILLER DEMO, PERMANENT PROTOTYPE, BOOMTOWN) PIECEMEAL GROWTH (URBAN SPRAWL, ITERATIVE-INCREMENTAL DEVELOPMENT) KEEP IT WORKING (VITALITY, BABY STEPS, DAILY BUILD, FIRST, DO NO HARM) SHEARING LAYERS SWEEPING IT UNDER THE RUG (POTEMKIN VILLAGE, HOUSECLEANING, PRETTY FACE, QUARANTINE, HIDING IT UNDER THE BED, REHABILITATION) RECONSTRUCTION (TOTAL REWRITE, DEMOLITION, THROWAWAY THE FIRST ONE, START OVER) 6
  7. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Is there Any Hope ? Homeostasis and Retrospective feedback - “Homeostasis insulates the system from short-range fluctuations in its environment, while feedback mechanisms respond to long-term discrepancies between a system's actual and desired behavior, and adjust it accordingly.” •  One of mud's most effective enemies is sunshine •  Leverage Extreme Programming •  Rely heavily on feedback to keep requirements in sync with code •  Do not engage in extensive up-front planning •  Pair programming and Test Driven Development 7
  8. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Map to Nirvana 1.  Keep the system healthy 2.  Conscientiously alternate periods 1.  EXPANSION 2.  CONSOLIDATION 3.  Identify Seams 4.  Find an inflection point 5.  Cover the inflection point •  Break external dependencies •  Break internal dependencies 6.  Write tests. 7.  Make changes 8.  Refactor the covered code. 8
  9. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Cloud Native Developer Experience
  10. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Yes!   You  can  get  these   benefits  by  building   Cloud  Na5ve  Apps  on   the  Cloud    
  11. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Wait!   You  have  a  por:olio       of  legacy  applica5ons.   Can  they*  be  moved?   How  do  we  do  this?   *  Okay,  if  you  s5ll  have  apps  running  on  an  IBM    System/360,  they  wouldn’t  be  the  first  I  would  move  J  
  12. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ The Prospect of Legacy Transformation Your portfolio is a complicated and poorly documented mix of many things App architecture is generally tightly coupled code and complex dependencies Your people spend their days working with legacy technology; they lack new skills
  13. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Approaches to App Migration 13
  14. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Migrating the Monolith OLD SCHOOL Measure Twice, Cut Once Detailed Application Assessment Magic Quadrant Application Suitability Static Analysis Rule Sets Questionnaires Analysis - Paralysis NEW SCHOOL Repeated smaller experiments Push app to production Test Driven Migration Replatforming Refactoring Extreme Refactoring 14
  15. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Transform to Cloud Native Applications TRANSFORMATION      APPLICATION  REPLATFORMING   §  Find  Suitable  Apps   §  Make  Minimal  Code  Changes   §  Enable  Con5nuous  Delivery   §  Move  Tested  Apps  to  PCF   §  Establish  Repeatable  Process   §  Enable  Cloud  Na5ve  Skills   Move  10’s  of  Exis.ng  Apps  to  Pivotal  Cloud  Foundry  With  Minimal  Rework    APPLICATION  MODERNIZATION   §  Plan  Data  &  App  Architecture   §  Reshape  Legacy  Code     §  Build  Microservices   §  Enable  Con5nuous  Delivery   §  Use  Pivotal  Methodology   §  Enable  Cloud  Na5ve  Skills   Modernize  a  Complex  Legacy  System  Into  Cloud  Na.ve  Architecture
  16. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Traditional Ways of Transforming 16
  17. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Traditional Ways of Transforming Ÿ  Led by a Large SI on a Multi-Phase Program Ÿ  Always Starts with Analysis using Tools and/or Surveys Ÿ  Long projects with big budgets and large batches of work Ÿ  Results : powerpoint assessments NO running code PORTFOLIO  ANALYSIS   DESIGN   MIGRATION   TESTING   ACCEPTANCE  
  18. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Application Suitability Assessment 18
  19. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ App Suitability Magic Quadrants 19
  20. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ App Replatforming
  21. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ What We Believe •  Test Driven Deployment •  Work Incrementally •  Failure is Okay, Experimentation Informs Strategy •  Break Big Things Into Small Chunks Start With “One Thing” Keep Your Feedback Cycle as Short as Possible Automate Everything You Can (TDD, CI/ CD) Build New Skills Through Pairing and By Doing
  22. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Extreme Refactoring Process Scoping Inception Implementation Time Bound 10 weeks, 4 pairs ✪ ✪ Running applications ✪ ✪
  23. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Application Portfolio Scoping •  Discovery –  What is the problem we are solving –  Understand App and Service composition –  Broad App Technology Choices •  Framing –  How to Solve the Problem –  Migration Flows for Java & .NET apps •  Explain Baseline assumptions –  App push to production –  CI/CD Pipelines –  Extreme Programming
  24. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Tools for Scoping •  Contextual Enquiries •  List All the APIs of an application java jdepend.textui.Jdepend spring-music-master/build | sed -n '/Summary/,$p' > <report.log> •  Static Analysis Tools 1.  SonarQube 2.  Coverity 3.  FindBugs 4.  Checkstyle 5.  PMD •  Spring Migration Analyzer 24
  25. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Inception 1.  Goals 2.  Non Goals 3.  Risks 4.  Roles & Personas 5.  Story Mapping 6.  Estimation 7.  Prioritization 8.  Risks (revisited) 9.  Next Steps 10. Retrospective
  26. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Post Inception Backlog
  27. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Cloud Foundry Sssh!! Let me Tell you a secret loves cloud native and non-cloud native apps is a polyglot platform (♥ Ruby, Groovy, Go, .NET, etc.)
  28. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Java App Replatforming Decision Tree
  29. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Java EE Web & Full Profile
  30. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Forklift Strategies q  Push JavaEE Web profile apps to Java BP if they only use the servlet container + spring libraries q  Push JavaEE Full profile apps to TomEE Buildpack q  Create a self-contained fat jar, including the app server runtime into the app q  Dockerize apps with Patterns and Recipes q  Deploy app as a with BOSH release(VM/Job + Persistent disk) q  Covert app to a managed service by creating a custom app-service broker 30
  31. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Dot Net App Replatforming
  32. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ CI/CD Pipeline Deploys to Production
  33. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Continous Integration Source Control • git • svn • cvs • TFS/VSS • clearcase • mercurial CI Server • Jenkins • Concourse • TeamCIty • GoCD • Bamboo • Travis • Wercker • TFS Artifact Server • Artifactory • Nexus Pro • Apache Ivy Requirements • Pivotal Tracker • Rally • JIRA • TFS • Clearcase
  34. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 12 Factor App Which Factors To Sacrifice ? What Are The Problem Signs
  35. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 1. Codebase - MANDATORY One codebase tracked in revision control, many deploys. •  Application is not in source control •  Application is in source control, but it spans multiple repositories and/or version control systems. •  There is no CI/CD pipeline 35 2. DEPENDENCIES - MANDATORY Explicitly declare and isolate dependencies •  Application cannot be deployed as a single, cohesive unit •  No Build Dependency Management System •  App release artifacts works in one environment and not another •  Relies on dependencies from a global context
  36. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 3. Configuration Store configuration in the environment. Ÿ  Proliferation of *.properties files (Java) Ÿ  Use of the Properties class (Java) Ÿ  Reading resources and files from disk for environment-specific settings Ÿ  All configuration is in the web.config and subsidiaries (.NET) Ÿ  Use of ConfigurationManager and related classes
  37. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 4. BACKING SERVICES Treat backing services as attached resources. Ÿ  Hard-coded (or non-environment-based) database connection strings Ÿ  Fixed URLs and/or ports for backing services Ÿ  Tight coupling with backing service type (e.g. relies on specific database driver rather than using adapters/JDBC/abstractions) Ÿ  Credentials for backing store embedded in configuration settings (may indicate tight environmental coupling) Ÿ  Backing services in Docker-to-Docker communication do not utilize Docker image linking. Ÿ  Relying on changes to the /etc/hosts file can be problematic in CF.
  38. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 5. Build, Release, Run Strictly separate build and run stages. Ÿ  Successful deployments to execution environment rely on the mutability of a deployment or the environment. Ÿ  Application fails the Configuration factor assessment. Ÿ  Cannot release, build, and run as separate, isolated activities.
  39. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 6. PROCESSES Execute the application as one or more stateless processes Ÿ  App is maintaining state (including session) in memory Ÿ  App shares data with other instances of itself (often found in home- grown HA solutions) Ÿ  App creates data on file system that will be used after the process terminates Ÿ  App is relying on Docker data volumes, which allow for data to persist outside the life cycle of the container Ÿ  App won’t function properly with multiple instances, or won’t function properly with multiple instances without the use of sticky sessions
  40. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 7. Port Binding Export services via port binding. Ÿ  App accepts input via non-HTTP communications protocols - JMX, Multicast, UDP, Custom TCP, RMI-IIOP Ÿ  Hard, fixed requirements to specific ports (e.g. app won’t start unless it is granted port 8081) Ÿ  App requires companion / worker / helper processes within process space or available on certain ports
  41. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 8. Concurrency Scale out via the process model. Ÿ  App cannot currently be scaled to multiple instances Ÿ  App cannot be scaled to multiple instances without “sticky session” routing Ÿ  App has huge memory requirements for scaling Ÿ  Reliance on, distributed Ÿ  App has failed the configuration and processes factors. Ÿ  App currently being deployed as an EAR/WAR.
  42. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 9. DISPOSABILITY Maximize robustness with fast startup and graceful shutdown Ÿ  Takes longer than 5 minutes for the application to start Ÿ  Terminating an application with SIGTERM can cause data loss or corruption Ÿ  Stopping IIS or terminating the app process/pool (.NET) can cause data loss or corruption Ÿ  Terminating an application takes a very long time/requires complicated coordination of resource de-allocation.
  43. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 10. Dev/Prod Parity Keep development, staging, and production as similar as possible. Ÿ  Docker containers that are pre-merged with configuration (e.g. they have a “QA Docker” and a “Prod Docker”) Ÿ  Prod and Dev differ to the point where app behavior varies across environments. Ÿ  Time gap between Dev/QA deployment and production is very long - often a symptom of large disparity between environments.
  44. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 11. LOGS Treat logs as event streams. Ÿ  Not using a unified logging solution (log4j, logback, slf4j, log4net, etc) and not using stdout for logs Ÿ  Custom code built into it for log aggregation and shipping rather than relying on external tools
  45. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Factors Not Supported •  12. Admin Processes - Run admin/management tasks as one-off processes. •  Hardware Architecture & OS - Can only run applications built to for x86 or x64 systems. •  Event Based Triggers - No system support of CRON or timer-based schedulers. •  Background Processing, Queue Consumers and Multi Proc Apps – No native Support •  Security – PAM & OS Based authentication mechanism will not work
  46. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Critical Features 1.  Project Diego 2.  CF v3 API 3.  TCP Routing 4.  Production Grade Persistence Services 5.  Route Services 6.  Context Path Routing
  47. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ PaaS Impediments & Remediations Anti-Cloud Pattern Remediation Multiple Inbound protocols like RMI, JMX, Custom-TCP TCP Routing, Tunneling, RMI over HTTP Persistence in local VMs like Caches, Transaction logs, CMS External managed data services, S3 Compatible blob store, mount external NFS locally, rsync, BOSH release a cf app Distributed Transactions - JTA & 2-pc commit Use standalone transaction managers like Atomikos & Bitronix . Introduce eventual consistency patterns Configuration Externalize, Plugin config via Config Server, Environment properties, System Properties, ServletInitializer that generates properties file Long Running Batch Processes CF v3 API - Different process types
  48. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Let Me Bring You Back From the Evil Empire 1.  Get a lay of the land. Identify ALL the open source and proprietary APIs used by the app. •  Make a list of all WebSphere/WebLogic/JBOSS Proprietary APIs used by your app, •  Make a list of all the Java EE APIs used by your app, •  Make a list of all Spring Framework APIs used the app, •  Make a list of all 3rd party open source frameworks used by the app 2.  Look at all the XML files bundled within the app. •  Replace vendor specific deployment descriptors with TomEE descriptors or Spring Beans in Tomcat. 3.  Server scoped shared libraries will need to be bundled in the app when pushed to CF.
  49. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Migrating from Enterprise App Servers to JBP 4.  Disaggregate the EAR file into multiple war files and tie them together as one logical app. 5.  Take advantage of Java EE6 and collapse EJBs and Servlets in a single war file. 6.  Do not concern yourself with anything that deals with clustering, workload management, HA, smart routing or proxying. 7.  Check if there is any native code and ensure that the native library is included with the app and built on the linuxfs32 file system. 8.  Decide which messaging engine to use to exchange messages asynchronously. CF provides multiple JMS & AMQP messaging providers. 9.  Auto-configure connections to back-end services or use spring-cloud- connectors to explicitly control the JDBC connection to the persistence tier in the cloud. 49
  50. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Finally Home… 10. Port JVM arguments, class path, and system properties to the buildpack and cf push manifests in Cloud Foundry. 11. Understand the external factors that affect migration like interaction with external CRM/ERP systems via XML or legacy web-service stacks. 12. If app relies on session persistence then configure session replication in CF by binding the app to a DB like Redis/Gemfire session replication on Cloud Foundry 13. http://wcmt.mybluemix.net/WMDT/#/ helps move Full WebSphere Application Server full profile applications to Liberty profile. Leverage tools like there and guides to from other app-server vendors. 14. Follow the Java App Migration Flow Chart to push the app to CF 50
  51. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Application Refactoring 51
  52. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Push 1.  Push the app 2.  See what fails 3.  Write a test to capture the failing assert 4.  Refactor app to get the tests to pass –  Sacrifice some of the 12 factors –  Create a story to track future refactoring 5.  Modified app passes the test 6.  Scrub & Repeat Pull 52 How To Refactor ? 1.  Understand Bounded Contexts by whiteboarding of activity & component diagrams 2.  Evaluate for 12 factor compliance. 3.  Chose which components we want to tackle. 4.  Rely heavily on integration tests, refactoring tools and interfaces 5.  Leverage Proxy/Façade/Smart Routing pattern to create an alternate implementation 6.  Run tests again pointing to the alternate endpoint 7.  If tests pass get rid of the original implementation
  53. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Breaking the Monolith – Picking Seams •  Stability and Point of Evolution •  Inbound and Outbound Coupling •  Tools - Xray, JDepend, Structure101 •  Databases & Data Stores •  Transaction Boundaries •  Modes of Communication •  Team Organization and Structure •  Use Cases/User Journeys •  Business Processes •  Verbs & Operations •  Nouns & Resources •  Separated models for reading and writing 53
  54. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Monolith Decomposition Patterns 54
  55. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Anti-Corruption Layer 55 https://leanpub.com/Practicing-DDD
  56. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ STRANGLING THE MONOLITH 56
  57. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Inverse Conway Maneuver •  Conway's Law asserts that organizations are constrained to produce application designs which are copies of their communication structures •  Leads to unintended friction points. •  Evolve your team and organizational structure to promote your desired architecture •  Break down silos to foster collaboration •  Your technology architecture will display isomorphism with your business architecture. 57
  58. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Adapter & Proxy Patterns 58 http://www.ibm.com/developerworks/rational/tutorials/ar-designpat1/
  59. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Façade Pattern 59
  60. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Smart Routing: Netflix Zuul •  Canary Testing •  Dynamic Routing •  Service Migration •  Load Shedding •  Active/Active Traffic Management http://projects.spring.io/spring-cloud/spring-cloud.html#_router_and_filter_zuul 60
  61. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Dark Launching/Feature Flags Wrapping software features in a way that let you turn them on or off •  Why ? •  Private beta release •  Commit your code in logical chunks •  Release a new feature to all your users at a specific date •  Not confident in how stable or how scalable a new feature is •  How ? •  Boolean – Feature will be on or off •  Percentage – Certain % of Users, Cookie, Random, Group •  List – User ID, Group ID, Organization ID, … •  Identity – Always on! and cannot be turned off. •  Nil - Always off! and cannot be turned on. •  Cloud Foundry Constructs •  cf scale, Configuration Server, Route Services 61
  62. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Migrating Data •  Tools – SchemaSpy •  Generate graphical representations of the relationships between tables. •  Tools - Liquibase, Flyway, jooQ •  Auto apply bundles of database refactorings •  Require a transition period during which both the original and new schemas exist in production •  Expose a Facade service to encapsulate DB changes •  Move logic and constraints to the edge aka services •  Implement retry and compensations •  Database Transformation Patterns cataloged in “Refactoring Databases” seminal book by by Scott J Ambler and Pramod J. Sadalage 62
  63. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Database Repository Pattern 63
  64. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ JavaEE vs Spring Framework 64
  65. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Desirability Of Apps Moving to Cloud Foundry •  Apps that are smaller than 100 MB •  Apps that do NOT use Java EE 5 or below APIs •  Apps that do NOT rely on a filesystem to persist across app restarts •  App that bundle all their libraries within the app like Spring + external libs •  Applications that do NOT leverage Distributed Transactions •  Apps that start and shutdown under 3 minutes •  Apps that do NOT use RMI, Multicast or other exotic TCP protocols. WebSocket is fine •  Apps that do NOT require custom hardware •  Apps that do NOT use app-server specific APIs or proprietary QoS •  Apps that are strategic to the business with a low cost of change 65
  66. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software,

    Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 66 [email protected] http://cloud.rohitkelapure.com/ eBook: Practical Microservices: http://bit.ly/practicalmicroservices Learn More. Stay Connected. @springcentral Spring.io/video