Microservices. SWE 432, Fall 2017 Design and Implementation of Software for the Web

Similar documents
Distributed Architectures & Microservices. CS 475, Spring 2018 Concurrent & Distributed Systems

Backend Development. SWE 432, Fall Web Application Development

Backend Development. SWE 432, Fall 2017 Design and Implementation of Software for the Web

Security. SWE 432, Fall 2017 Design and Implementation of Software for the Web

NoSQL & Firebase. SWE 432, Fall Web Application Development

Persistence & State. SWE 432, Fall 2016 Design and Implementation of Software for the Web

Review. Fundamentals of Website Development. Web Extensions Server side & Where is your JOB? The Department of Computer Science 11/30/2015

Persistence. SWE 432, Fall 2017 Design and Implementation of Software for the Web

BARCELONA. 2015, Amazon Web Services, Inc. or its affiliates. All rights reserved

RESTful Services. Distributed Enabling Platform

THOMAS LATOZA SWE 621 FALL 2018 DESIGN ECOSYSTEMS

Implementing the Twelve-Factor App Methodology for Developing Cloud- Native Applications

Lesson 14 SOA with REST (Part I)

Lecture 2: January 24

the road to cloud native applications Fabien Hermenier

Managing Data at Scale: Microservices and Events. Randy linkedin.com/in/randyshoup

Other architectures are externally built or expanded

Syllabus INFO-GB Design and Development of Web and Mobile Applications (Especially for Start Ups)

DATABASE SYSTEMS. Database programming in a web environment. Database System Course, 2016

CSC 443: Web Programming

Building modern enterprise applications from scratch: lessons learned DOAG 2014 Dr. Clemens Wrzodek

Help Me! A Consumer Product Assistance Application

Jenkins: A complete solution. From Continuous Integration to Continuous Delivery For HSBC

Cloud-Native Applications. Copyright 2017 Pivotal Software, Inc. All rights Reserved. Version 1.0

Reconstructive API for the DOM

Copyright 2014 Blue Net Corporation. All rights reserved

DATABASE SYSTEMS. Database programming in a web environment. Database System Course,

SOA: Service-Oriented Architecture

Build Meeting Room Management Website Using BaaS Framework : Usergrid

IBM s statements regarding its plans, directions, and intent are subject to change or withdrawal without notice at IBM s sole discretion.

August, HPE Propel Microservices & Jumpstart

Web API Best Practices

Full Stack Developer with Java

Web Software Model CS 4640 Programming Languages for Web Applications

Microservice Splitting the Monolith. Software Engineering II Sharif University of Technology MohammadAmin Fazli

Modern Web Application Development. Sam Hogarth

Microservices Architekturen aufbauen, aber wie?

System and Software Architecture Description (SSAD)

Zero to Microservices in 5 minutes using Docker Containers. Mathew Lodge Weaveworks

LOG8430: Architecture logicielle et conception avancée

App Engine: Datastore Introduction

CS193X: Web Programming Fundamentals

JAVASCRIPT CHARTING. Scaling for the Enterprise with Metric Insights Copyright Metric insights, Inc.

Microservices on AWS. Matthias Jung, Solutions Architect AWS

today what is this course about? what is this course about? Welcome to CSC309! Programming on the Web APRIL 05

RELIABILITY & AVAILABILITY IN THE CLOUD

Cloud platforms. T Mobile Systems Programming

Architecting for Scale

Real Life Web Development. Joseph Paul Cohen

Connecting your Microservices and Cloud Services with Oracle Integration CON7348

DESIGN AS RISK MINIMIZATION

The COS 333 Project. Robert M. Dondero, Ph.D. Princeton University

IBMi in the IT infrastructure of tomorrow

Back-end architecture

The Future of the Realtime Web BETTER APIS WITH GRAPHQL. Josh

CS 498RK FALL RESTFUL APIs

Develop Mobile Front Ends Using Mobile Application Framework A - 2

Functional Programming and the Web

INFO/CS 4302 Web Informa6on Systems

NewSQL Without Compromise

ArcGIS Enterprise: Architecture & Deployment. Anthony Myers

Scaling DreamFactory

WebRTC: Possible? Don McGregor Research Associate MOVES Institute.

Design and Architecture. Derek Collison

Whooo s calling Whooo?

Data Centers and Cloud Computing

Nevin Dong 董乃文 Principle Technical Evangelist Microsoft Cooperation

Java Architectures A New Hope. Eberhard Wolff

Project Report. Team 233. Hongnian Yu, Dong Liang, Tianlei Sun, Jian Zhu California Institute of Technology Department of Electrical Engineering

SSC - Web applications and development Introduction and Java Servlet (I)

REST Easy with Infrared360

Distributed Data Infrastructures, Fall 2017, Chapter 2. Jussi Kangasharju

Tutorial: Building the Services Ecosystem

Edge Foundational Training

CSE 454 Final Report TasteCliq

Using AWS to Build a Large Scale Dockerized Microservices Architecture. Dr. Oliver Wahlen moovel Group GmbH Frankfurt, 30.

CS 43: Computer Networks. HTTP September 10, 2018

Active Endpoints. ActiveVOS Platform Architecture Active Endpoints

REST in a Nutshell: A Mini Guide for Python Developers

Web Development for Dinosaurs An Introduction to Modern Web Development

Large-Scale Web Applications

API s in a hybrid world. Date 28 September 2017

Introduction to GraphQL and Relay. Presenter: Eric W. Greene

Western Michigan University

Server execution of JavaScript: What could possibly go wrong?

Prototyping a Social Network. AngularJS: Firebase integration with AngularFire

EDGE, MICROSOFT S BROWSER

Serverless Architecture Hochskalierbare Anwendungen ohne Server. Sascha Möllering, Solutions Architect

3 Continuous Integration 3. Automated system finding bugs is better than people

Cloud platforms T Mobile Systems Programming

Accenture Cloud Platform Serverless Journey

Example Azure Implementation for Government Agencies. Indirect tax-filing system. By Alok Jain Azure Customer Advisory Team (AzureCAT)

a Very Short Introduction to AngularJS

MarkLogic Server. Reference Application Architecture Guide. MarkLogic 9 May, Copyright 2017 MarkLogic Corporation. All rights reserved.

Microservices Smaller is Better? Eberhard Wolff Freelance consultant & trainer

Backend Web Frameworks

Web-APIs. Examples Consumer Technology Cross-Domain communication Provider Technology

Cloud Computing. Technologies and Types

Cloud Computing Platform as a Service

MASTERS COURSE IN FULL STACK WEB APPLICATION DEVELOPMENT W W W. W E B S T A C K A C A D E M Y. C O M

Transcription:

Micros SWE 432, Fall 2017 Design and Implementation of Software for the Web

Today How is a being a micro different than simply being ful? What are the advantages of a micro backend architecture over a monolithic architecture? Next time: what additional infrastructure is required to realize these advantages? 2

The good old days of backends HTTP Request GET /myapplicationendpoint HTTP/1.1 Host: cs.gmu.edu Accept: text/html web server Give me /myapplicationendpoint Runs a program Web Server Application Here s some text to send back Does whatever it wants My Application Backend HTTP Response HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 <html><head>... 3

History of Backend Development In the beginning, you wrote whatever you wanted using whatever language you wanted and whatever framework you wanted Then PHP and ASP Languages designed for writing backends Encouraged spaghetti code A lot of the web was built on this A whole lot of other languages were also springing up in the 90 s Ruby, Python, JSP 4

Monolothic backend Component presentation Component presentation Component presentation Browser Component logic Component logic Component logic Front end framework HTTP Request HTTP Response (JSON) Presentation tier Web Server Domain logic tier Persistence tier 5

Micros backend Component presentation Component presentation Component presentation Browser Component logic Component logic Component logic Front end framework HTTP Request HTTP Response (JSON) HTTP Request HTTP Request HTTP Response (JSON) HTTP Request Web Servers Micro HTTP Response (JSON) Micro HTTP Response (JSON) 6

ful APIs Recall guidelines for ful APIs from Lecture 6: Handling HTTP Requests Support scaling Use HTTP actions to support intermediaries (e.g., caches) Support change Leave anything out of URI that might change Ensure any URI changes are backwards compatible Support reuse Design URIs around resources that are expressive abstractions that support a range of client interactions Resources are nouns; use HTTP actions to signal verbs 7

Challenges building a ful monolith 8

Micros vs. Monoliths Advantages of micros over monoliths include Support for scaling Scale vertically rather than horizontally Support for change Support hot deployment of updates Support for reuse Use same web in multiple apps Swap out internally developed web for externally developed web Support for separate team development Pick boundaries that match team responsibilities Support for failure 9

Support for scaling Our Cool App Frontend Backend Server Mod 1 Mod 2 Mod 3 Mod 4 Mod 5 Mod 6 10

Now how do we scale it? Our Cool App Frontend Backend Server Mod 1 Mod 2 Mod 3 Mod 4 Mod 5 Mod 6 Backend Server Mod 1 Mod 2 Mod 3 Mod 4 Mod 5 Mod 6 Backend Server Mod 1 Mod 2 Mod 3 Mod 4 Mod 5 Mod 6 We run multiple copies of the backend, each with each of the modules 11

What's wrong with this picture? This is called the Our Cool App Frontend monolithic app Backend Server Mod 1 Mod 2 Backend Server Mod 1 Mod 2 Backend Server Mod 1 Mod 2 If we need 100 servers Mod 3 Mod 4 Mod 5 Mod 6 Mod 3 Mod 4 Mod 5 Mod 6 Mod 3 Mod 4 Mod 5 Mod 6 Each server will have to run EACH module What if we need more of some modules than others? 12

Micros NodeJS, Firebase Google Service Java, MySQL Todos Mod 1 Accounts Mod 2 Mod Mailer 3 Our Cool App Frontend Dumb Backend AJAX Mod Search 4 Engine Analytics Mod 5 Mod 6 Facebook Crawler Java, Neo4J C#, SQLServer Python, Firebase 13

Support for change: hot swapping In a large organization (e.g., Facebook, Amazon, AirBnb), will constantly have new features being finished and rolled out to production Traditional model: releases Finish next version of software, test, release as a unit once every year or two Web enables frequent updates Could update every night or even every hour But... if updating every hour, really do not want website to be down 14

Support for change in a monolith Our Cool App Frontend Backend Server Mod 1 Mod 2 Mod 3 Mod 4 Mod 5 Mod 6 Backend Server Mod 1 Mod 2 Mod 3 Mod 4 Mod 5 Mod 6 Backend Server Mod 1 Mod 2 Mod 3 Mod 4 Mod 5 Mod 6 15

Micros NodeJS, Firebase Google Service Java, MySQL Todos Mod 1 Accounts Mod 2 Mod Mailer 3 Our Cool App Frontend Dumb Backend AJAX Mod Search 4 Engine Analytics Mod 5 Mod 6 Facebook Crawler Java, Neo4J C#, SQLServer Python, Firebase 16

Support for reuse In a large organization (e.g., Facebook, Amazon, AirBnb), may have many internal products that all depend on a similar core (e.g., user account storage, serving static assets) Would like to be able to build functionality once, reuse in many place swap out an old implementation for a new implementation with a new technology or implementation swap out an internal for a similar external 17

Support for reuse in a monolith Our Cool App Frontend Backend Server Mod 1 Mod 2 Mod 3 Mod 4 Mod 5 Mod 6 Backend Server Mod 1 Mod 2 Mod 3 Mod 4 Mod 5 Mod 6 Backend Server Mod 1 Mod 2 Mod 3 Mod 4 Mod 5 Mod 6 18

Micros NodeJS, Firebase Google Service Java, MySQL Todos Mod 1 Accounts Mod 2 Mod Mailer 3 Our Cool App Frontend Dumb Backend AJAX Mod Search 4 Engine Analytics Mod 5 Mod 6 Facebook Crawler Java, Neo4J C#, SQLServer Python, Firebase 19

Conway's Law The structure of an organization mirrors the structure of a product. Building a car. Have a team for tires Have a team for drivetrain Have a team for seating Have a team for paint Have a team for... Could pick a product structure and design team around it. Or could pick a desired team structure and design product around it. 20

Organization in a monolith Frontend Orders, shipping, catalog Classic teams: 1 team per tier Backend Orders, shipping, catalog Orders, shipping, catalog 21

Organization around business capabilities in micros Orders Example: Amazon Shipping Teams can focus on one business task And be responsible directly to users Full Stack Catalog 2 pizza teams 22

How big is a micro? Metaphor: Building a stereo system Components are independently replaceable Components are independently updatable This means that they can be also independently developed, tested, etc Components can be built as: Library (e.g. module) Service (e.g. web ) 23

Goals of micros Add them independently Upgrade the independently Reuse them independently Develop them independently ==> Have ZERO coupling between micros, aside from their shared interface 24

Exercise: Design a restaurant review site In groups of 2 or 3, build diagram depicting a set of micros, their connections, and a list of important endpoints Requirements Restaurant owners can create restaurant pages, add links to website, add food keywords, update address and business info Restaurant reviewers can post reviews of a restaurant, see reviews they've written, comment on other reviews. All users can search for a restaurant based on its food keywords and address. Users have accounts, with profile information and settings. 25

Design for Failure Each of the many micros might fail Services might have bugs Services might be slow to respond Entire servers might go down If I have 60,000 hard disks, 3 fail a day The more micros there are, the higher the likelihood at least one is currently failing Key: design every assuming that at some point, everything it depends on might disappear - must fail gracefully Netflix simulates this constantly with ChaosMonkey 26

Support for failure Goal: Support graceful degradation with failures Design for idempotency Should be able to retry requests without introducing bad data Design for data locality Transactions across micros are hard to manage Design for eventual consistency 27

Design for idempotency Want to design APIs so that executing an action multiple times leads to same resulting state Prefer state changes on existing entity rather than creating new entities 28

Design for data locality If datastore server fails or is slow, do not want entire site to go down. Decentralizes implementation decisions. Allows each to manage data in the way that makes the most sense for that Also performance benefit: caching data locally in micros enables faster response Rule: Services exchange data ONLY through their exposed APIs - NO shared databases 29

Consistency NodeJS, Firebase Google Service Java, MySQL One of our rules was no shared database But surely some state will be shared Updates are sent via HTTP request Our Cool App Frontend Dumb Backend AJAX Mod 1 Todos Mod 4 Search Engine Java, Neo4J Mod 2 Accounts Mod 5 Analytics C#, SQLServer Mod 3 Mailer Mod Facebook 6 Crawler Python, Firebase No guarantee that those updates occur immediately Instead, guarantee that they occur eventually Can force some ordering, but that s expensive 30

Maintaining Consistency NodeJS, Firebase Google Service Java, MySQL Mod 1 Todos Mod 2 Accounts Mod 3 Mailer Our Cool App Frontend Dumb Backend AJAX Mod 4 Search Engine Mod 5 Analytics Mod 6 Facebook Crawler Java, Neo4J Core problem: different s may respond to requests at different times. What if a request results in change to resource in one, but other has not yet processed corresponding request? C#, SQLServer Python, Firebase May end up with different states in different resources. Logic needs to be written to correctly handle such situations. 31

Eventual Consistency: Example 32

Reading for next time Fundamentals of DevOps: https://blogs.oracle.com/developers/gettingstarted-with-micros-part-four 33