SlideShare a Scribd company logo
1 of 43
Download to read offline
CSU33012 Software Engineering
I. Introduction to
Microservices
Goetz Botterweck
Change Log
2023-10-09 First version
2
CSU33012 Goetz Botterweck
I. Introduction to
Microservices
3
CSU33012 Goetz Botterweck
References
Microservices
(Newman 2021) Newman, Sam. Building Microservices (2ed). O’Reilly, 2021.
https://www.amazon.co.uk/Building-Microservices-Second-Sam-Newman/dp/1492034029/
(Richardson 2019) Richardson, Chris. Microservice Patterns: With examples in Java. Manning, 2019.
https://www.amazon.co.uk/Microservice-Patterns-examples-Chris-Richardson/dp/1617294543/
4
CSU33012 Goetz Botterweck
References
Design of Data-Intensive Distributed Systems
(Kleppmann 2016) Kleppmann, Martin. Designing Data-Intensive Applications: The Big Ideas Behind Reliable,
Scalable, and Maintainable Systems. O’Reilly, 2016.
https://www.amazon.co.uk/Designing-Data-Intensive-Applications-Reliable-Maintainable/dp/1449373321/
5
CSU33012 Goetz Botterweck
References
Spring Boot
(Turnquist 2022) Turnquist, Greg L. Learning Spring Boot 3.0: Simplify the development of
production-grade applications (3ed). Packt, 2022.
ISBN 978-1803233307
https://www.amazon.co.uk/Learning-Spring-Boot-3-0-production-grade/dp/1803233303/
(Larsson 2023) Larsson, Magnus. Microservices with Spring Boot 3 and Spring Cloud:
Build resilient and scalable microservices using Spring Cloud, Istio, and
Kubernetes. Packt, 2023.
ISBN 978-1805128694
https://www.amazon.co.uk/Microservices-Spring-Boot-Cloud-microservices/dp/1805128698/
(Heckler 2021) Heckler, Mark. Spring Boot: Up and Running: Building Cloud Native Java
and Kotlin Applications. O’Reilly, 2021.
ISBN 978-1492076988
https://www.amazon.co.uk/Spring-Boot-Running-Building-Applications/dp/1492076988
6
CSU33012 Goetz Botterweck
References
Spring Boot (Further Reading)
(Walls 2015) Walls, Craig. Spring Boot in Action. Manning, 2015.
ISBN 978-1617292545
https://www.amazon.co.uk/Spring-Boot-Action-Craig-Walls/dp/1617292540/
(Somewhat dated)
(García 2020) García, Moisés Macero. Learn Microservices with Spring Boot: A
Practical Approach to RESTful Services Using an Event-Driven
Architecture, Cloud-Native Patterns, and Containerization. Apress, 2020
ISBN 978-1484261309
https://www.amazon.co.uk/Learn-Microservices-Spring-Boot-Containerization/dp/1484261305/
(new edition coming 13 December 2023)
7
CSU33012 Goetz Botterweck
1. Introduction to
Microservices
CSU33012 Goetz Botterweck 8
Monolith to Microservices
CSU33012 Goetz Botterweck 9
Microservices
• Architectural style
• Structures application as a
collection of small autonomous
services
• Key Characteristics
• Single Responsibility: Each service
focuses on a single functionality
• Independence: developed,
deployed, and scaled separately
• Decentralized
• Autonomy: self-contained and
manages its own data.
CSU33012 Goetz Botterweck 10
Image: tutorialspoint.com
• To be completed
CSU33012 Goetz Botterweck 11
2. Hypertext Transfer
Protocol (HTTP)
CSU33012 Goetz Botterweck 12
2.1 HTTP Overview
CSU33012 Goetz Botterweck 13
HyperText Transfer Protocol (HTTP)
• Rules for the communication between web browser and web server
• Transporting hypertext content to the web browser
• Client-server model (request-response)
• Stateless
• Server does not remember any information about the client (in the basic
model)
• Challenging for application developers
• How do you store state (e.g., a shopping cart)?
• How do you track what users are doing (e.g., click path through the website)?
• How do you know that it‘s a authorized user?
https://developer.mozilla.org/en-US/docs/Web/HTTP
https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview
CSU33012 Goetz Botterweck 14
HTTP
HyperText Transfer Protocol
CSU33012 Goetz Botterweck 15
HTTP
HyperText Transfer Protocol
CSU33012 Goetz Botterweck 16
HTTP
HyperText Transfer Protocol
CSU33012 Goetz Botterweck 17
HTTP
HyperText Transfer Protocol
CSU33012 Goetz Botterweck 18
HTTP
HyperText Transfer Protocol
CSU33012 Goetz Botterweck 19
HTTP
HyperText Transfer Protocol
CSU33012 Goetz Botterweck 20
HTTP
HyperText Transfer Protocol
CSU33012 Goetz Botterweck 21
2.2 A Typical HTTP Session
https://developer.mozilla.org/en-US/docs/Web/HTTP/Session
CSU33012 Goetz Botterweck 22
Typical 4 Phases in Client-Server Protocols
1. The server "listens", it opens a TCP socket and waits for a
connection.
2. The client establishes a connection to the server.
3. The client sends a request.
4. The server processes the request and sends a response.
This is a common pattern, based on the TCP/IP Stack, oriented on a
request-response model. There are other variants.
CSU33012 Goetz Botterweck 23
1. Server Listens
• The server opens a socket (identified by an IP address and a TCP port)
and binds to that. The server "listens" on that port.
• For instance, port 80 on IP 18.66.171.91 (one of the servers providing
www.tcd.ie).
• Hence, it will be informed by the operating system when a new
connection comes in.
• Different ports = Different types of services
• e.g., traditionally HTTP on port 80, SMTP on port 25, etc.
• Different ports = Different instances of a service
• e.g., port 80 public web server, port 81 development web server
• Same port = Different instances a service, e.g., multiple websites
CSU33012 Goetz Botterweck 24
2. Client Connects
• The client might have to lookup the IP address from a domain name.
• e.g. www.tcd.ie → 18.66.171.91
• The client opens a TCP connection to the server's socket (IP address +
TCP port)
• On the client-side the connection also has a socket (IP address + TCP
Port).
• The port is often automatically generated for the connection.
• Together the two sockets (source IP, source port, dest. IP, dest. port) uniquely
identify the connection.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Session#Establishing_a_connection
CSU33012 Goetz Botterweck 25
3. Client Sends Request
• HTTP request consists of text
lines, separated by CRLF.
• Method + Path + Protocol
• HTTP Header
• Data Block (Optional), mainly used
by POST Method
https://developer.mozilla.org/en-
US/docs/Web/HTTP/Session#Sending_a_client_request
GET / HTTP/1.1
Host: developer.mozilla.org
Accept-Language: fr
(empty line to end header)
CSU33012 Goetz Botterweck 26
3. Client Sends Request
• Request Methods
GET request a data representation
of the request
POST send data to the server, so
that it may change its state;
mostly used by HTML forms
https://developer.mozilla.org/en-
US/docs/Web/HTTP/Session#Sending_a_client_request
POST /contact_form.php HTTP/1.1
Host: developer.mozilla.org
Content-Length: 64
Content-Type: application/x-www-form-urlencoded
name=Joe%20User&request=Send%20me%20one%20of%20you
r%20catalogue
CSU33012 Goetz Botterweck 27
4. Server Processes Request, Sends Response
• A HTTP response consists of text
lines, separated by CRLF.
• Status line: Protocol + Status (incl.
a brief human-readable status)
• HTTP Header
• Data Block (Optional)
https://developer.mozilla.org/en-
US/docs/Web/HTTP/Session#Sending_a_client_reque
st
HTTP/1.1 200 OK
Date: Sat, 09 Oct 2010 14:28:02 GMT
Server: Apache
(more headers)
Content-Length: 29769
Content-Type: text/html
(empty line to end header)
<!DOCTYPE html...
CSU33012 Goetz Botterweck 28
4. Server Processes Request, Sends Response
HTTP/1.1 200 OK
Date: Sat, 09 Oct 2010 14:28:02 GMT
Server: Apache
Last-Modified: Tue, 01 Dec 2009 20:18:22 GMT
ETag: "51142bc1-7449-479b075b2891b"
Accept-Ranges: bytes
Content-Length: 29769
Content-Type: text/html
<!DOCTYPE html... (here comes the 29769 bytes of the requested web page)
CSU33012 Goetz Botterweck 29
4. Server Processes Request, Sends Response
HTTP/1.1 301 Moved Permanently
Server: Apache/2.2.3 (Red Hat)
Content-Type: text/html; charset=iso-8859-1
Date: Sat, 09 Oct 2010 14:30:24 GMT
Location: https://developer.mozilla.org/ (this is the new link to the resource; it is expected that the user-agent
will fetch it)
Keep-Alive: timeout=15, max=98
Accept-Ranges: bytes
Via: Moz-Cache-zlb05
Connection: Keep-Alive
X-Cache-Info: caching
X-Cache-Info: caching
Content-Length: 325 (the content contains a default page to display if the user-agent is not able to follow the
link)
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https://developer.mozilla.org/">here</a>.</p>
<hr>
<address>Apache/2.2.3 (Red Hat) Server at developer.mozilla.org Port 80</address>
</body></html>
CSU33012 Goetz Botterweck 30
4. Server Processes Request, Sends Response
HTTP/1.1 404 Not Found
Date: Sat, 09 Oct 2010 14:33:02 GMT
Server: Apache
Last-Modified: Tue, 01 May 2007 14:24:39 GMT
ETag: "499fd34e-29ec-42f695ca96761;48fe7523cfcc1"
Accept-Ranges: bytes
Content-Length: 10732
Content-Type: text/html
<!DOCTYPE html... (contains a site-customized page helping the user to
find the missing resource)
CSU33012 Goetz Botterweck 31
2.3 HTTP Status Codes
CSU33012 Goetz Botterweck 32
HTTP Status Codes
• 1xx Informational Response
• 2xx Success
• 3xx Redirection
• 4xx Client Error
• 5xx Server Error
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
CSU33012 Goetz Botterweck 33
HTTP Status
1xx Informational Response
• 100 Continue
• 101 Switching Protocols – Server has agreed to switch protocols
• 102 Processing – Still working on it, don't time out
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
CSU33012 Goetz Botterweck 34
HTTP Status
2xx Success
• 200 OK – Standard response for successful HTTP requests.
• 201 Created – Request fulfilled, resulting in the creation of a new
resource.
• 202 Accepted – Request accepted for processing, but the processing
has not been completed.
• 203 Non-Authoritative Information (since HTTP/1.1) – Returning
modified content.
• …
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
CSU33012 Goetz Botterweck 35
HTTP Status
3xx Redirection
• …
• 301 Moved Permanently – This and all future requests should be
directed to the given URI
• …
• 304 Not Modified – You can use the cached copy that you have.
• …
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
CSU33012 Goetz Botterweck 36
HTTP Status
4xx Client Error
• 400 Bad Request
• 401 Unauthorized (RFC 7235)
• …
• 403 Forbidden
• 404 Not Found
• …
• 418 I'm a teapot (RFC 2324)
• …
• 451 Unavailable For Legal Reasons (RFC 7725) – See Fahrenheit 451
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
CSU33012 Goetz Botterweck 37
HTTP Status
5xx Server Error
• 500 Internal Server Error
• …
• 503 Service Unavailable
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
CSU33012 Goetz Botterweck 38
HTTP Methods (Verbs)
• GET – Fetch a URL
• HEAD – Fetch information about a URL
• PUT – Store to an URL
• PATCH – Partial modification of resource at an URL
• POST – Send form data to a URL and get a response back
• DELETE – Delete a URL
CSU33012 Goetz Botterweck 39
3. RESTful APIs
CSU33012 Goetz Botterweck 40
REST
• Representational State Transfer
• architectural style for designing networked applications
• defines a way to provide an “interface”
• Roy Fielding (2000)
• Uses HTTP requests to trigger data operations
• POST (create)
• PUT (update)
• PATCH (partial update)
• GET (read)
• DELETE (erase)
CSU33012 Goetz Botterweck 41
Key Principles of REST
• Client-Server Architecture
• Client and server are independent
• Can evolve separately
• Statelessness
• Each HTTP request contains all information needed to process it
• Server does not retain any information
• Cacheability
• Responses can be explicitly marked as cacheable or non-cacheable
• Uniform Interface
• Resource Identification (URI)
• Self-descriptive messages - each HTTP request contains all information
needed to process it (see Statelessness)
CSU33012 Goetz Botterweck 42
Data Representation in RESTful APIs
• JSON (JavaScript Object Notation)
• XML (Extensible Markup Language)
CSU33012 Goetz Botterweck 43

More Related Content

Similar to CSU33012-I-microservices.pdf

HTTP/2 What's inside and Why
HTTP/2 What's inside and WhyHTTP/2 What's inside and Why
HTTP/2 What's inside and WhyAdrian Cole
 
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)Ericom Software
 
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....Marcin Bielak
 
SPDY - http reloaded - WebTechConference 2012
SPDY - http reloaded - WebTechConference 2012SPDY - http reloaded - WebTechConference 2012
SPDY - http reloaded - WebTechConference 2012Fabian Lange
 
Website & Internet + Performance testing
Website & Internet + Performance testingWebsite & Internet + Performance testing
Website & Internet + Performance testingRoman Ananev
 
Monitoring as an entry point for collaboration
Monitoring as an entry point for collaborationMonitoring as an entry point for collaboration
Monitoring as an entry point for collaborationJulien Pivotto
 
DN 2017 | Big Data / Microservice Versioning | Thomas Pötter | Compris Techno...
DN 2017 | Big Data / Microservice Versioning | Thomas Pötter | Compris Techno...DN 2017 | Big Data / Microservice Versioning | Thomas Pötter | Compris Techno...
DN 2017 | Big Data / Microservice Versioning | Thomas Pötter | Compris Techno...Dataconomy Media
 
Http/2 - What's it all about?
Http/2  - What's it all about?Http/2  - What's it all about?
Http/2 - What's it all about?Andy Davies
 
Module 1-Application Layer
Module 1-Application Layer Module 1-Application Layer
Module 1-Application Layer Gururaj H L
 
Web Performance Optimization with HTTP/3
Web Performance Optimization with HTTP/3Web Performance Optimization with HTTP/3
Web Performance Optimization with HTTP/3SangJin Kang
 
IRJET- An Overview of Web Sockets: The Future of Real-Time Communication
IRJET- An Overview of Web Sockets: The Future of Real-Time CommunicationIRJET- An Overview of Web Sockets: The Future of Real-Time Communication
IRJET- An Overview of Web Sockets: The Future of Real-Time CommunicationIRJET Journal
 
Improving performance by changing the rules from fast to SPDY
Improving performance by changing the rules   from fast to SPDYImproving performance by changing the rules   from fast to SPDY
Improving performance by changing the rules from fast to SPDYCotendo
 
From Fast To SPDY
From Fast To SPDYFrom Fast To SPDY
From Fast To SPDYMike Belshe
 
Linux HTTPS/TCP/IP Stack for the Fast and Secure Web
Linux HTTPS/TCP/IP Stack for the Fast and Secure WebLinux HTTPS/TCP/IP Stack for the Fast and Secure Web
Linux HTTPS/TCP/IP Stack for the Fast and Secure WebAll Things Open
 

Similar to CSU33012-I-microservices.pdf (20)

6 app-tcp
6 app-tcp6 app-tcp
6 app-tcp
 
HTTP/2 What's inside and Why
HTTP/2 What's inside and WhyHTTP/2 What's inside and Why
HTTP/2 What's inside and Why
 
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
 
Http2 kotlin
Http2   kotlinHttp2   kotlin
Http2 kotlin
 
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....
Internet of Things - protocols review (MeetUp Wireless & Networks, Poznań 21....
 
SPDY - http reloaded - WebTechConference 2012
SPDY - http reloaded - WebTechConference 2012SPDY - http reloaded - WebTechConference 2012
SPDY - http reloaded - WebTechConference 2012
 
Website & Internet + Performance testing
Website & Internet + Performance testingWebsite & Internet + Performance testing
Website & Internet + Performance testing
 
Monitoring as an entry point for collaboration
Monitoring as an entry point for collaborationMonitoring as an entry point for collaboration
Monitoring as an entry point for collaboration
 
DN 2017 | Big Data / Microservice Versioning | Thomas Pötter | Compris Techno...
DN 2017 | Big Data / Microservice Versioning | Thomas Pötter | Compris Techno...DN 2017 | Big Data / Microservice Versioning | Thomas Pötter | Compris Techno...
DN 2017 | Big Data / Microservice Versioning | Thomas Pötter | Compris Techno...
 
Browser Security
Browser SecurityBrowser Security
Browser Security
 
Demystifying REST
Demystifying RESTDemystifying REST
Demystifying REST
 
Http/2 - What's it all about?
Http/2  - What's it all about?Http/2  - What's it all about?
Http/2 - What's it all about?
 
Module 1
Module 1Module 1
Module 1
 
Module 1-Application Layer
Module 1-Application Layer Module 1-Application Layer
Module 1-Application Layer
 
Cgi
CgiCgi
Cgi
 
Web Performance Optimization with HTTP/3
Web Performance Optimization with HTTP/3Web Performance Optimization with HTTP/3
Web Performance Optimization with HTTP/3
 
IRJET- An Overview of Web Sockets: The Future of Real-Time Communication
IRJET- An Overview of Web Sockets: The Future of Real-Time CommunicationIRJET- An Overview of Web Sockets: The Future of Real-Time Communication
IRJET- An Overview of Web Sockets: The Future of Real-Time Communication
 
Improving performance by changing the rules from fast to SPDY
Improving performance by changing the rules   from fast to SPDYImproving performance by changing the rules   from fast to SPDY
Improving performance by changing the rules from fast to SPDY
 
From Fast To SPDY
From Fast To SPDYFrom Fast To SPDY
From Fast To SPDY
 
Linux HTTPS/TCP/IP Stack for the Fast and Secure Web
Linux HTTPS/TCP/IP Stack for the Fast and Secure WebLinux HTTPS/TCP/IP Stack for the Fast and Secure Web
Linux HTTPS/TCP/IP Stack for the Fast and Secure Web
 

Recently uploaded

VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Effects of rheological properties on mixing
Effects of rheological properties on mixingEffects of rheological properties on mixing
Effects of rheological properties on mixingviprabot1
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
pipeline in computer architecture design
pipeline in computer architecture  designpipeline in computer architecture  design
pipeline in computer architecture designssuser87fa0c1
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 

Recently uploaded (20)

VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Effects of rheological properties on mixing
Effects of rheological properties on mixingEffects of rheological properties on mixing
Effects of rheological properties on mixing
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
pipeline in computer architecture design
pipeline in computer architecture  designpipeline in computer architecture  design
pipeline in computer architecture design
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 

CSU33012-I-microservices.pdf

  • 1. CSU33012 Software Engineering I. Introduction to Microservices Goetz Botterweck
  • 2. Change Log 2023-10-09 First version 2 CSU33012 Goetz Botterweck
  • 4. References Microservices (Newman 2021) Newman, Sam. Building Microservices (2ed). O’Reilly, 2021. https://www.amazon.co.uk/Building-Microservices-Second-Sam-Newman/dp/1492034029/ (Richardson 2019) Richardson, Chris. Microservice Patterns: With examples in Java. Manning, 2019. https://www.amazon.co.uk/Microservice-Patterns-examples-Chris-Richardson/dp/1617294543/ 4 CSU33012 Goetz Botterweck
  • 5. References Design of Data-Intensive Distributed Systems (Kleppmann 2016) Kleppmann, Martin. Designing Data-Intensive Applications: The Big Ideas Behind Reliable, Scalable, and Maintainable Systems. O’Reilly, 2016. https://www.amazon.co.uk/Designing-Data-Intensive-Applications-Reliable-Maintainable/dp/1449373321/ 5 CSU33012 Goetz Botterweck
  • 6. References Spring Boot (Turnquist 2022) Turnquist, Greg L. Learning Spring Boot 3.0: Simplify the development of production-grade applications (3ed). Packt, 2022. ISBN 978-1803233307 https://www.amazon.co.uk/Learning-Spring-Boot-3-0-production-grade/dp/1803233303/ (Larsson 2023) Larsson, Magnus. Microservices with Spring Boot 3 and Spring Cloud: Build resilient and scalable microservices using Spring Cloud, Istio, and Kubernetes. Packt, 2023. ISBN 978-1805128694 https://www.amazon.co.uk/Microservices-Spring-Boot-Cloud-microservices/dp/1805128698/ (Heckler 2021) Heckler, Mark. Spring Boot: Up and Running: Building Cloud Native Java and Kotlin Applications. O’Reilly, 2021. ISBN 978-1492076988 https://www.amazon.co.uk/Spring-Boot-Running-Building-Applications/dp/1492076988 6 CSU33012 Goetz Botterweck
  • 7. References Spring Boot (Further Reading) (Walls 2015) Walls, Craig. Spring Boot in Action. Manning, 2015. ISBN 978-1617292545 https://www.amazon.co.uk/Spring-Boot-Action-Craig-Walls/dp/1617292540/ (Somewhat dated) (García 2020) García, Moisés Macero. Learn Microservices with Spring Boot: A Practical Approach to RESTful Services Using an Event-Driven Architecture, Cloud-Native Patterns, and Containerization. Apress, 2020 ISBN 978-1484261309 https://www.amazon.co.uk/Learn-Microservices-Spring-Boot-Containerization/dp/1484261305/ (new edition coming 13 December 2023) 7 CSU33012 Goetz Botterweck
  • 10. Microservices • Architectural style • Structures application as a collection of small autonomous services • Key Characteristics • Single Responsibility: Each service focuses on a single functionality • Independence: developed, deployed, and scaled separately • Decentralized • Autonomy: self-contained and manages its own data. CSU33012 Goetz Botterweck 10 Image: tutorialspoint.com
  • 11. • To be completed CSU33012 Goetz Botterweck 11
  • 12. 2. Hypertext Transfer Protocol (HTTP) CSU33012 Goetz Botterweck 12
  • 13. 2.1 HTTP Overview CSU33012 Goetz Botterweck 13
  • 14. HyperText Transfer Protocol (HTTP) • Rules for the communication between web browser and web server • Transporting hypertext content to the web browser • Client-server model (request-response) • Stateless • Server does not remember any information about the client (in the basic model) • Challenging for application developers • How do you store state (e.g., a shopping cart)? • How do you track what users are doing (e.g., click path through the website)? • How do you know that it‘s a authorized user? https://developer.mozilla.org/en-US/docs/Web/HTTP https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview CSU33012 Goetz Botterweck 14
  • 22. 2.2 A Typical HTTP Session https://developer.mozilla.org/en-US/docs/Web/HTTP/Session CSU33012 Goetz Botterweck 22
  • 23. Typical 4 Phases in Client-Server Protocols 1. The server "listens", it opens a TCP socket and waits for a connection. 2. The client establishes a connection to the server. 3. The client sends a request. 4. The server processes the request and sends a response. This is a common pattern, based on the TCP/IP Stack, oriented on a request-response model. There are other variants. CSU33012 Goetz Botterweck 23
  • 24. 1. Server Listens • The server opens a socket (identified by an IP address and a TCP port) and binds to that. The server "listens" on that port. • For instance, port 80 on IP 18.66.171.91 (one of the servers providing www.tcd.ie). • Hence, it will be informed by the operating system when a new connection comes in. • Different ports = Different types of services • e.g., traditionally HTTP on port 80, SMTP on port 25, etc. • Different ports = Different instances of a service • e.g., port 80 public web server, port 81 development web server • Same port = Different instances a service, e.g., multiple websites CSU33012 Goetz Botterweck 24
  • 25. 2. Client Connects • The client might have to lookup the IP address from a domain name. • e.g. www.tcd.ie → 18.66.171.91 • The client opens a TCP connection to the server's socket (IP address + TCP port) • On the client-side the connection also has a socket (IP address + TCP Port). • The port is often automatically generated for the connection. • Together the two sockets (source IP, source port, dest. IP, dest. port) uniquely identify the connection. https://developer.mozilla.org/en-US/docs/Web/HTTP/Session#Establishing_a_connection CSU33012 Goetz Botterweck 25
  • 26. 3. Client Sends Request • HTTP request consists of text lines, separated by CRLF. • Method + Path + Protocol • HTTP Header • Data Block (Optional), mainly used by POST Method https://developer.mozilla.org/en- US/docs/Web/HTTP/Session#Sending_a_client_request GET / HTTP/1.1 Host: developer.mozilla.org Accept-Language: fr (empty line to end header) CSU33012 Goetz Botterweck 26
  • 27. 3. Client Sends Request • Request Methods GET request a data representation of the request POST send data to the server, so that it may change its state; mostly used by HTML forms https://developer.mozilla.org/en- US/docs/Web/HTTP/Session#Sending_a_client_request POST /contact_form.php HTTP/1.1 Host: developer.mozilla.org Content-Length: 64 Content-Type: application/x-www-form-urlencoded name=Joe%20User&request=Send%20me%20one%20of%20you r%20catalogue CSU33012 Goetz Botterweck 27
  • 28. 4. Server Processes Request, Sends Response • A HTTP response consists of text lines, separated by CRLF. • Status line: Protocol + Status (incl. a brief human-readable status) • HTTP Header • Data Block (Optional) https://developer.mozilla.org/en- US/docs/Web/HTTP/Session#Sending_a_client_reque st HTTP/1.1 200 OK Date: Sat, 09 Oct 2010 14:28:02 GMT Server: Apache (more headers) Content-Length: 29769 Content-Type: text/html (empty line to end header) <!DOCTYPE html... CSU33012 Goetz Botterweck 28
  • 29. 4. Server Processes Request, Sends Response HTTP/1.1 200 OK Date: Sat, 09 Oct 2010 14:28:02 GMT Server: Apache Last-Modified: Tue, 01 Dec 2009 20:18:22 GMT ETag: "51142bc1-7449-479b075b2891b" Accept-Ranges: bytes Content-Length: 29769 Content-Type: text/html <!DOCTYPE html... (here comes the 29769 bytes of the requested web page) CSU33012 Goetz Botterweck 29
  • 30. 4. Server Processes Request, Sends Response HTTP/1.1 301 Moved Permanently Server: Apache/2.2.3 (Red Hat) Content-Type: text/html; charset=iso-8859-1 Date: Sat, 09 Oct 2010 14:30:24 GMT Location: https://developer.mozilla.org/ (this is the new link to the resource; it is expected that the user-agent will fetch it) Keep-Alive: timeout=15, max=98 Accept-Ranges: bytes Via: Moz-Cache-zlb05 Connection: Keep-Alive X-Cache-Info: caching X-Cache-Info: caching Content-Length: 325 (the content contains a default page to display if the user-agent is not able to follow the link) <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>301 Moved Permanently</title> </head><body> <h1>Moved Permanently</h1> <p>The document has moved <a href="https://developer.mozilla.org/">here</a>.</p> <hr> <address>Apache/2.2.3 (Red Hat) Server at developer.mozilla.org Port 80</address> </body></html> CSU33012 Goetz Botterweck 30
  • 31. 4. Server Processes Request, Sends Response HTTP/1.1 404 Not Found Date: Sat, 09 Oct 2010 14:33:02 GMT Server: Apache Last-Modified: Tue, 01 May 2007 14:24:39 GMT ETag: "499fd34e-29ec-42f695ca96761;48fe7523cfcc1" Accept-Ranges: bytes Content-Length: 10732 Content-Type: text/html <!DOCTYPE html... (contains a site-customized page helping the user to find the missing resource) CSU33012 Goetz Botterweck 31
  • 32. 2.3 HTTP Status Codes CSU33012 Goetz Botterweck 32
  • 33. HTTP Status Codes • 1xx Informational Response • 2xx Success • 3xx Redirection • 4xx Client Error • 5xx Server Error https://en.wikipedia.org/wiki/List_of_HTTP_status_codes CSU33012 Goetz Botterweck 33
  • 34. HTTP Status 1xx Informational Response • 100 Continue • 101 Switching Protocols – Server has agreed to switch protocols • 102 Processing – Still working on it, don't time out https://en.wikipedia.org/wiki/List_of_HTTP_status_codes CSU33012 Goetz Botterweck 34
  • 35. HTTP Status 2xx Success • 200 OK – Standard response for successful HTTP requests. • 201 Created – Request fulfilled, resulting in the creation of a new resource. • 202 Accepted – Request accepted for processing, but the processing has not been completed. • 203 Non-Authoritative Information (since HTTP/1.1) – Returning modified content. • … https://en.wikipedia.org/wiki/List_of_HTTP_status_codes CSU33012 Goetz Botterweck 35
  • 36. HTTP Status 3xx Redirection • … • 301 Moved Permanently – This and all future requests should be directed to the given URI • … • 304 Not Modified – You can use the cached copy that you have. • … https://en.wikipedia.org/wiki/List_of_HTTP_status_codes CSU33012 Goetz Botterweck 36
  • 37. HTTP Status 4xx Client Error • 400 Bad Request • 401 Unauthorized (RFC 7235) • … • 403 Forbidden • 404 Not Found • … • 418 I'm a teapot (RFC 2324) • … • 451 Unavailable For Legal Reasons (RFC 7725) – See Fahrenheit 451 https://en.wikipedia.org/wiki/List_of_HTTP_status_codes CSU33012 Goetz Botterweck 37
  • 38. HTTP Status 5xx Server Error • 500 Internal Server Error • … • 503 Service Unavailable https://en.wikipedia.org/wiki/List_of_HTTP_status_codes CSU33012 Goetz Botterweck 38
  • 39. HTTP Methods (Verbs) • GET – Fetch a URL • HEAD – Fetch information about a URL • PUT – Store to an URL • PATCH – Partial modification of resource at an URL • POST – Send form data to a URL and get a response back • DELETE – Delete a URL CSU33012 Goetz Botterweck 39
  • 40. 3. RESTful APIs CSU33012 Goetz Botterweck 40
  • 41. REST • Representational State Transfer • architectural style for designing networked applications • defines a way to provide an “interface” • Roy Fielding (2000) • Uses HTTP requests to trigger data operations • POST (create) • PUT (update) • PATCH (partial update) • GET (read) • DELETE (erase) CSU33012 Goetz Botterweck 41
  • 42. Key Principles of REST • Client-Server Architecture • Client and server are independent • Can evolve separately • Statelessness • Each HTTP request contains all information needed to process it • Server does not retain any information • Cacheability • Responses can be explicitly marked as cacheable or non-cacheable • Uniform Interface • Resource Identification (URI) • Self-descriptive messages - each HTTP request contains all information needed to process it (see Statelessness) CSU33012 Goetz Botterweck 42
  • 43. Data Representation in RESTful APIs • JSON (JavaScript Object Notation) • XML (Extensible Markup Language) CSU33012 Goetz Botterweck 43