Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
83 views

w10s1 MicroServices API

This document discusses microservices and API gateways. It begins by comparing monolithic and microservice architectures. It then defines what an API is and discusses common API terms like HTTP, URL, JSON, and REST. It explains that an API gateway acts as a single entry point and reverse proxy for microservices by handling features like security, routing, and load balancing. It also discusses service discovery, orchestration, and popular microservices frameworks like Spring Boot and Flask. In the example provided, a basic Flask application is created to demonstrate a simple API.

Uploaded by

Lastri Siregar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
83 views

w10s1 MicroServices API

This document discusses microservices and API gateways. It begins by comparing monolithic and microservice architectures. It then defines what an API is and discusses common API terms like HTTP, URL, JSON, and REST. It explains that an API gateway acts as a single entry point and reverse proxy for microservices by handling features like security, routing, and load balancing. It also discusses service discovery, orchestration, and popular microservices frameworks like Spring Boot and Flask. In the example provided, a basic Flask application is created to demonstrate a simple API.

Uploaded by

Lastri Siregar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Microservices & API Gateway

Johannes Sianipar
18 February 2021
Monolithic vs Microservice

Microservices

Chart 2
Monolithic vs Microservice

Microservices

Chart 3
What is API?

■ Application Programming Interface


■ A part of a computer program
designed to be used or manipulated
by another program
□ as opposed to an interface
designed to be used or
manipulated by a human
■ Computer programs frequently need
to communicate amongst
themselves or with the underlying
operating system.
□ System Call API Microservices

□ http://abc.com/search/pages/resu
lts/
Chart 4
Terms in API

■ HTTP (Hypertext Transfer Protocol) is the primary means of communicating data on the web.
□ HTTP implements a number of “methods,” which tell which direction data is moving and what
should happen to it.
□ The two most common are GET, which pulls data from a server, and POST, which pushes new
data to a server.
■ URL (Uniform Resource Locator) - An address for a resource on the web, such as
https://programminghistorian.org/about.
□ A URL consists of a protocol (http://), domain (programminghistorian.org), and optional path
(/about).
□ A URL describes the location of a specific resource, such as a web page.
□ When reading about APIs, you may see the terms URL, request, URI, or endpoint used to
describe adjacent ideas.
■ JSON (JavaScript Object Notation) is a text-based data storage format that is designed to be
easy to read for both humans and machines.
□ JSON is generally the most common format for returning data through an API, XML being the
second most common.
Microservices
■ REST (REpresentational State Transfer) is an architecture style for designing networked
applications.
□ REST vs SOAP (Simple Object Access Protocol)
□ APIs designed with some or all of these principles in mind are called REST APIs. Chart 5
Why API Gateway

■ How to deal with features such as security,


throttling, caching and monitoring at one place?
■ How to avoid chatty communication between clients
and microservices?
■ How to satisfy the needs of heterogeneous clients?
■ How to route requests to backend microservices?
■ How to discover working microservice instances?
■ How to discover when a microservice instance is not
running?

Microservices

Chart 6
API Gateway

■ Basically, the API Gateway is a reverse proxy to microservices and acts


as a single-entry point into the system.

Microservices

Chart 7
API Gateway

■ Basically, the API Gateway is a reverse proxy to microservices and acts


as a single-entry point into the system.

Microservices

Chart 8
Security in API Gateway

■ Security architecture using OAuth2.0.

Microservices

Chart 9
Service Registry

■ Service registry helps to keep track of these instances.


□ A database containing the network locations of the service instances.
□ Every service instance registers itself on start-up and de-registers on
shutdown.

Microservices

Chart 10
Service Discovery

■ The number and location of service


instances is dynamic.
□ Consequently, your client code needs
to use a more elaborate service
discovery mechanism.
■ There are two main service discovery
patterns:
□ client-side discovery and server side
discovery

Microservices

Chart 11
Orchestration

Microservices

Chart 12
Load Balancing

Microservices

Chart 13
Microservices Framework

■ Java
□ Spring Boot, Dropwizard, Restlet, Spark
■ Python
□ Flask, Falcom, Bottle, Nameko, CherryPy
■ Node JS
■ .Net

Microservices

Chart 14
Microservices Framework

■ Java
□ Spring Boot, Dropwizard, Restlet, Spark
■ Python
□ Flask, Falcom, Bottle, Nameko, CherryPy
■ Node JS
■ .Net

Microservices

Chart 15
Basic Flask Code Example

import flask

app = flask.Flask(__name__)
app.config["DEBUG"] = True

@app.route('/', methods=['GET'])
def home():
return "<h1>Distant Reading Archive</h1><p>This site is a prototype
API for distant reading of science fiction novels.</p>"

Microservices
app.run()

Chart 16
Reference

■ https://www.globallogic.com/wp-content/uploads/2017/08/Microservice-
Architecture-API-Gateway-Considerations.pdf
■ https://www.ibm.com/cloud/architecture/architectures/microservices
■ https://programminghistorian.org/en/lessons/creating-apis-with-python-
and-flask#what-is-an-api

Microservices

Chart 17
Thank you
for your attention!
Johannes Sianipar

You might also like