Microservices HTTP://WWW.WEBAGESOLUTIONS.COM/TRAINING/MICROSERVICES/ What are Microservices?  A microservices-based application is a distributed system, with each service instance running as a process Microservices must interact using an inter-process communication protocol such as HTTP or message queueing, depending on the nature of each service. A microservice or microservice composition results in a business transaction A microservice is accessed through its known API which acts as a published contract for the service consumers Microservices collaborate with each other in a decentralized fashion using built-in intelligence for request routing and embedded business logic Adoption of microservices is facilitated by the DevOps practices for containerization, CI/CD and Enterprise Application Integration

© 2017 2 Demystifying Microservices HTTP://WWW.WEBAGESOLUTIONS.COM/TRAINING/MICROSERVICES/

3 Microservices Analogy It may help to understand what microservices are by drawing an analogy with Unix command-line tools You can build quite sophisticated data processing chains by joining various Unix command-line tools through the piping ('|') mechanism For example, the following commands will count the number of lines containing the '#' character in all files with the extension .csv in the working folder: cat *.csv | grep '#' | wc -l You can think of a microservice as a stand-alone Unix tool that does a small (and useful) job and which lends itself for participating in some form of collaboration with other microservices to produce a solution to a task in a specific problem domain Solutions are created from suites of loosely coupled and cohesive microservices

© 2017 4 Monolithic vs. Microservice

© 2017 5 Qualities of Microservices

Componentization via Services Organized around Business Capabilities Products not Projects Smart endpoints and dumb pipes Decentralized Governance Decentralized Data Management Infrastructure Automation Design for failure Evolutionary Design

© 2017 6 Cloud Native Applications

7 Key Components of Successful Microservices Teams  “A3 & C”  Shared Accountability for service consistency  Automation of cattle  Architecture patterns  Culture of Containerization  Other keys areas include DevOps, collaboration, gold master example, and standards

© 2017 8 Designing for failure  Microservices architecture based components are designed for failure. Any service can fail, anytime The client application has to respond as gracefully as possible It's important to be able to detect the failures quickly and, if possible, automatically restore service Microservices applications put a lot of emphasis on real-time monitoring Netflix's Chaos Monkey induces failures of services during the working day to test the application's resilience and monitoring

© 2017 9 Microservices In a Nutshell  Shift Left. Microservices go hand-in-hand with Agile software development methodologies and DevOps. Competitive Advantage. Clean, well managed services improve agility and velocity. Technology Enabled Business. Time to market and value is enabled by a componentized application, built on the principal of MVP.  Gold Master. Every organization needs their reference architecture and working examples to simplify consistent adoption across the enterprise.

© 2017 10 Docker and Microservices  Docker containers drives the adoption of microservices and vice versa. Docker puts significant emphasis on the "Unix philosophy" of shipping containers, i.e. "do one thing, and do it well".  Run only one process per container. In almost all cases, you should only run a single process in a single container. Decoupling applications into multiple containers makes it much easier to scale horizontally and reuse containers.  When aiming for "doing one thing" it doesn't make sense to containerize the entire, huge, enterprise application as a single Docker container.  You would want to first modularize the application into loosely coupled components that communicate via standard protocols, which in essence, is what the microservices architecture delivers.  Docker containers and microservices architecture enable continuous delivery.

© 2017 11 Single Page Applications  The SPAs are web applications that have a single web page and all views render dynamically when the user interacts with the application. SPAs use to call backend data through services and most of the work is done on the client side:

© 2017 12 Spring Boot  Spring Boot (http://projects.spring.io/spring-boot/) is a project within the Spring IO Platform (https://spring.io/platform)  Developed in response to Spring Platform Request SPR-9888 "Improved support for 'containerized' web application architectures"  Inspired by the DropWizard framework (http://www.dropwizard.io/)  Spring Boot focuses on facilitating a fast-path creation of stand-alone web applications packaged as executable JAR files with minimum configuration.  An excellent choice for creating microservices, but many options abound e.g. Go, Ruby, Node, C++, C#, or other Java frameworks

© 2017 13 Data Management Considerations  Microservice applications are decomposed to components – smaller independent service applications.  Components are loosely coupled and that includes the backing store

© 2017 14 © 2017 15 JSON Web Token (JWT)  JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. This information can be verified and trusted because it is digitally signed. JWT contains the header and the payload. The first part is the token’s header which identifies the token’s type and the algorithm used to sign the token.  The second part is the JWT token’s payload or its claims. There’s a distinction between these two.  A payload can be an arbitrary set of data, it can be even plaintext or another (nested JWT).  Claim JWT contain a standard set of fields.  https://jwt.io

© 2017 16 Service Fabric Application Modernization 1) Take a traditional monolithic application 2) and Shift - Use containers or guest executables to host existing code in Service Fabric. 3) Modernization - New microservices added alongside existing containerized code. 4) Innovate - Break the monolithic into microservices purely based on need. 5) Transformed into microservices - the transformation of existing monolithic applications or building new greenfield applications.

© 2017 17 Questions ? HTTP://WWW.WEBAGESOLUTIONS.COM/TRAINING/MICROSERVICES/