SlideShare a Scribd company logo
1 of 50
Download to read offline
© Ian Sommerville 2018
Chapter 6
Microservices architecture
© Ian Sommerville 2018:Microservices architecture
• A software service is a software component that can be accessed from
remote computers over the Internet. Given an input, a service produces
a corresponding output, without side effects.
• The service is accessed through its published interface and all details of the
service implementation are hidden.
• Services do not maintain any internal state. State information is either stored in
a database or is maintained by the service requestor.
• When a service request is made, the state information may be included
as part of the request and the updated state information is returned as
part of the service result.
• As there is no local state, services can be dynamically reallocated from
one virtual server to another and replicated across several servers.
Software services
2
© Ian Sommerville 2018:Microservices architecture
• After various experiments in the 1990s with service-oriented computing,
the idea of ‘big’ Web Services emerged in the early 2000s.
• These were based on XML-based protocols and standards such as
SOAP for service interaction and WSDL for interface description.
• Most software services don’t need the generality that’s inherent in the
design of web service protocols.
• Consequently, modern service-oriented systems, use simpler, ‘lighter
weight’ service-interaction protocols that have lower overheads and,
consequently, faster execution.
Modern web services
3
© Ian Sommerville 2018:Microservices architecture
• Microservices are small-scale, stateless, services that have a single
responsibility. They are combined to create applications.
• They are completely independent with their own database and UI
management code.
• Software products that use microservices have a microservices
architecture.
• If you need to create cloud-based software products that are adaptable,
scaleable and resilient then I recommend that design them around a
microservices architecture.
Microservices
4
© Ian Sommerville 2018:Microservices architecture
• System authentication
• User registration, where users provide information about their identity, security
information, mobile (cell) phone number and email address.
• Authentication using UID/password.
• Two-factor authentication using code sent to mobile phone.
• User information management e.g. change password or mobile phone number.
• Reset forgotten password.
• Each of these features could be implemented as a separate service that
uses a central shared database to hold authentication information.
• However, these features are too large to be microservices. To identify the
microservices that might be used in the authentication system, you need to
break down the coarse-grain features into more detailed functions.
A microservice example
5
© Ian Sommerville 2018:Microservices architecture
Figure 6.1 Functional breakdown of authentication features
6
User registration
Setup new login id
Setup new password
Setup password recovery information
Setup two-factor authentication
Confirm registration
Authenticate using UID/password
Get login id
Get password
Check credentials
Confirm authentication
Figure 6.1 Functional breakdown of authentication features
© Ian Sommerville 2018:Microservices architecture
Figure 6.2 Authentication microservices
7
UID
management
Password
management
User info
management
UID data
Password data
User data
Authentication
Figure 6.2 Authentication microservices
© Ian Sommerville 2018:Microservices architecture
Self-contained

Microservices do not have external dependencies. They manage their own data and
implement their own user interface.
Lightweight

Microservices communicate using lightweight protocols, so that service
communication overheads are low.
Implementation-independent

Microservices may be implemented using different programming languages and may
use different technologies (e.g. different types of database) in their implementation.
Independently deployable

Each microservice runs in its own process and is independently deployable, using
automated systems.
Business-oriented

Microservices should implement business capabilities and needs, rather than simply
provide a technical service.
Table 6.1 Characteristics of microservices
8
© Ian Sommerville 2018:Microservices architecture
• Microservices communicate by exchanging messages.
• A message that is sent between services includes some administrative
information, a service request and the data required to deliver the
requested service.
• Services return a response to service request messages.
• An authentication service may send a message to a login service that includes
the name input by the user.
• The response may be a token associated with a valid user name or might be an
error saying that there is no registered user.
Microservice communication
9
© Ian Sommerville 2018:Microservices architecture
• A well-designed microservice should have high cohesion and low
coupling.
• Cohesion is a measure of the number of relationships that parts of a component
have with each other. High cohesion means that all of the parts that are needed
to deliver the component’s functionality are included in the component.
• Coupling is a measure of the number of relationships that one component has
with other components in the system. Low coupling means that components do
not have many relationships with other components.
• Each microservice should have a single responsibility i.e. it should do
one thing only and it should do it well.
• However, ‘one thing only’ is difficult to define in a way that’s applicable to all
services.
• Responsibility does not always mean a single, functional activity.
Microservice characteristics
10
© Ian Sommerville 2018:Microservices architecture
Figure 6.3 Password management functionality
11
Figure 6.3 Password management functionality
User functions
Create password
Change password
Check password
Recover password
Supporting functions
Check password validity
Delete password
Backup password database
Recover password database
Check database integrity
Repair password DB
© Ian Sommerville 2018:Microservices architecture
Figure 6.4 Microservice support code
12
Microservice X
Service functionality
Message
management
UI
implementation
Failure
management
Data consistency
management
Figure 6.4 Microservice support code
© Ian Sommerville 2018:Microservices architecture
• A microservices architecture is an architectural style – a tried and tested
way of implementing a logical software architecture.
• This architectural style addresses two problems with monolithic
applications
• The whole system has to be rebuilt, re-tested and re-deployed when any
change is made. This can be a slow process as changes to one part of the
system can adversely affect other components.
• As the demand on the system increases, the whole system has to be scaled,
even if the demand is localized to a small number of system components that
implement the most popular system functions.
Microservices architecture
13
© Ian Sommerville 2018:Microservices architecture
• Microservices are self-contained and run in separate processes.
• In cloud-based systems, each microservice may be deployed in its own
container. This means a microservice can be stopped and restarted
without affecting other parts of the system.
• If the demand on a service increases, service replicas can be quickly
created and deployed. These do not require a more powerful server so
‘scaling-out’ is, typically, much cheaper than ’scaling up’.
•
Benefits of microservices architecture
14
© Ian Sommerville 2018:Microservices architecture
Imagine that you are developing a photo printing service for mobile devices.
Users can upload photos to your server from their phone or specify photos from
their Instagram account that they would like to be printed. Prints can be made at
different sizes and on different media.
Users can chose print size and print medium. For example, they may decide to
print a picture onto a mug or a T-shirt. The prints or other media are prepared and
then posted to their home. They pay for prints either using a payment service
such as Android or Apple Pay or by registering a credit card with the printing
service provider.
Table 6.2 A photo printing system for mobile devices
15
© Ian Sommerville 2018:Microservices architecture
Figure 6.5 A microservices architecture for a photo printing system
16
Mobile
app API gateway
Authentication
Figure 6.5 A microservices architecture for a photo printing system
SERVICES
Registration
Upload
Payment
Printing
Despatch
© Ian Sommerville 2018:Microservices architecture
Figure 6.6 Microservices architecture - key design questions
17
What are the microservices that
make up the system?
How should microservices
communicate with each other?
How should the microservices
in the system be coordinated?
How should service failure be
detected, reported and managed?
How should data be
distributed and shared?
Microservices
architecture
design
Figure 6.6 Microservices architecture - key design questions
© Ian Sommerville 2018:Microservices architecture
• Balance fine-grain functionality and system performance
• Single-function services mean that changes are limited to fewer services but require service
communications to implement user functionality. This slows down a system because of the need
for each service to bundle and unbundle messages sent from other services.
• Follow the ‘common closure principle’
• Elements of a system that are likely to be changed at the same time should be located within the
same service. Most new and changed requirements should therefore only affect a single service.
• Associate services with business capabilities
• A business capability is a discrete area of business functionality that is the responsibility of an
individual or a group. You should identify the services that are required to support each business
capability.
• Design services so that they only have access to the data that they need
• If there is an overlap between the data used by different services, you need a mechanism to
propagate data changes to all services using the same data.
Decomposition guidelines
18
© Ian Sommerville 2018:Microservices architecture
• Services communicate by exchanging messages that include
information about the originator of the message, as well as the data that
is the input to or output from the request.
• When you are designing a microservices architecture, you have to
establish a standard for communications that all microservices should
follow. Some of the key decisions that you have to make are
• should service interaction be synchronous or asynchronous?
• should services communicate directly or via message broker middleware?
• what protocol should be used for messages exchanged between services?
Service communications
19
© Ian Sommerville 2018:Microservices architecture
Figure 6.7 Synchronous and asynchronous microservice interaction
20
Service A
Figure 6.7 Synchronous and asynchronous microservice interaction
Calls
Returns
Requests (B)
Synchronous - A waits for B
Asynchronous - A and B execute concurrently
Queue B Queue A
Requests (A)
Service B
Service A
Processing Waiting Processing
Processing Processing
Processing Processing
ProcessingProcessing
Service B
© Ian Sommerville 2018:Microservices architecture
• In a synchronous interaction, service A issues a request to service B.
Service A then suspends processing while B is processing the request.
• It waits until service B has returned the required information before
continuing execution.
• In an asynchronous interaction, service A issues the request that is
queued for processing by service B. A then continues processing without
waiting for B to finish its computations.
• Sometime later, service B completes the earlier request from service A
and queues the result to be retrieved by A.
• Service A, therefore, has to check its queue periodically to see if a result
is available.
•
Synchronous and asynchronous interaction
21
© Ian Sommerville 2018:Microservices architecture
Figure 6.8 Direct and indirect service communication
22
Figure 6.8 Direct and indirect service communication
Direct communication - A and B send messages to each other
Indirect communication - A and B communicate through a message broker
Message broker
Service A Service B
Service A Service B
© Ian Sommerville 2018:Microservices architecture
• Direct service communication requires that interacting services know
each other’s address.
• The services interact by sending requests directly to these addresses.
• Indirect communication involves naming the service that is required and
sending that request to a message broker (sometimes called a message
bus).
• The message broker is then responsible for finding the service that can
fulfil the service request.
Direct and indirect service communication
23
© Ian Sommerville 2018:Microservices architecture
• You should isolate data within each system service with as little data
sharing as possible.
• If data sharing is unavoidable, you should design microservices so that
most sharing is ‘read-only’, with a minimal number of services
responsible for data updates.
• If services are replicated in your system, you must include a mechanism
that can keep the database copies used by replica services consistent.
Microservice data design
24
© Ian Sommerville 2018:Microservices architecture
• An ACID transaction bundles a set of data updates into a single unit so
that either all updates are completed or none of them are. ACID
transactions are impractical in a microservices architecture.
• The databases used by different microservices or microservice replicas
need not be completely consistent all of the time.
• Dependent data inconsistency
• The actions or failures of one service can cause the data managed by another
service to become inconsistent.
• Replica inconsistency
• There are several replicas of the same service that are executing concurrently.
These all have their own database copy and each updates its own copy of the
service data. You need a way of making these databases ‘eventually consistent’
so that all replicas are working on the same data.
Inconsistency management
25
© Ian Sommerville 2018:Microservices architecture
• Eventual consistency is a situation where the system guarantees that the
databases will eventually become consistent.
• You can implement eventual consistency by maintaining a transaction
log.
• When a database change is made, this is recorded on a ‘pending
updates’ log.
• Other service instances look at this log, update their own database and
indicate that they have made the change.
Eventual consistency
26
© Ian Sommerville 2018:Microservices architecture
Figure 6.9 Using a pending transaction log
27
Pending transactions log
A1/DB update 1
A1/DB update 2
A2/DB update 1
Figure 6.9 Using a pending transactions log
Service A1
Database A
Service A2
Database A
© Ian Sommerville 2018:Microservices architecture
• Most user sessions involve a series of interactions in which operations
have to be carried out in a specific order.
• This is called a workflow.
• An authentication workflow for UID/password authentication shows the steps
involved in authenticating a user.
• In this example, the user is allowed 3 login attempts before the system indicates
that the login has failed.
Service coordination
28
© Ian Sommerville 2018:Microservices architecture
Figure 6.10 Authentication workflow
29
End
Retry
login
Get login
Start
End
Check
login
Get
password
Check
password
Indicate
failure
login OK
login invalid
password OK
password
invalid
attempts > 3
attempts = 1
authfail = F
authfail=T
Figure 6.10 Authentication workflow
authfail = F
Increment
attempts
attempts <= 3
authfail = T
authfail=F
© Ian Sommerville 2018:Microservices architecture
Figure 6.11 Orchestration and choreography
30
Authentication
controller
Service orchestration Service choreography
Figure 6.11 Orchestration and choreography
Authentication eventsLogin
service
Password
service
Login
service
Password
service
© Ian Sommerville 2018:Microservices architecture
Internal service failure

These are conditions that are detected by the service and can be reported to the
service client in an error message. An example of this type of failure is a service
that takes a URL as an input and discovers that this is an invalid link.
External service failure

These failures have an external cause, which affects the availability of a service.
Failure may cause the service to become unresponsive and actions have to be
taken to restart the service.
Service performance failure

The performance of the service degrades to an unacceptable level. This may be
due to a heavy load or an internal problem with the service. External service
monitoring can be used to detect performance failures and unresponsive
services.
Table 6.3 Failure types in a microservices system
31
© Ian Sommerville 2018:Microservices architecture
• A timeout is a counter that this associated with the service requests and
starts running when the request is made.
• Once the counter reaches some predefined value, such as 10 seconds,
the calling service assumes that the service request has failed and acts
accordingly.
• The problem with the timeout approach is that every service call to a
‘failed service’ is delayed by the timeout value so the whole system slows
down.
• Instead of using timeouts explicitly when a service call is made, he
suggests using a circuit breaker. Like an electrical circuit breaker, this
immediately denies access to a failed service without the delays
associated with timeouts.
Timeouts and circuit breakers
32
© Ian Sommerville 2018:Microservices architecture
Figure 6.12 Using a circuit breaker to cope with service failure
33
Circuit breaker
Check S2
availability
retries>3
retries<=3
timeout ok
timeout fail
S2 available
S2 unavailable
Figure 6.12 Using a circuit breaker to cope with service failure
Service S1 Service S2
Set timeout Route service
request
Respond S2
unavailable
Set S2
unavailable
Route service
response
Increment
retries
Check
timeout
© Ian Sommerville 2018:Microservices architecture
• The REST (REpresentational State Transfer) architectural style is based
on the idea of transferring representations of digital resources from a
server to a client.
• You can think of a resource as any chunk of data such as credit card details, an
individual’s medical record, a magazine or newspaper, a library catalogue, and
so on.
• Resources are accessed via their unique URI and RESTful services operate on
these resources.
• This is the fundamental approach used in the web where the resource is
a page to be displayed in the user’s browser.
• An HTML representation is generated by the server in response to an HTTP
GET request and is transferred to the client for display by a browser or a
special-purpose app.
RESTful services
34
© Ian Sommerville 2018:Microservices architecture
Use HTTP verbs

The basic methods defined in the HTTP protocol (GET, PUT, POST, DELETE)
must be used to access the operations made available by the service.
Stateless services

Services must never maintain internal state. As I have already explained,
microservices are stateless so fit with this principle.
URI addressable

All resources must have a URI, with a hierarchical structure, that is used to
access sub-resources.
Use XML or JSON

Resources should normally be represented in JSON or XML or both. Other
representations, such as audio and video representations, may be used if
appropriate.
Table 6.4 RESTful service principles
35
© Ian Sommerville 2018:Microservices architecture
Create

Implemented using HTTP POST, which creates the resource with the given URI. If the
resource has already been created, an error is returned.
Read

Implemented using HTTP GET, which reads the resource and returns its value. GET
operations should never update a resource so that successive GET operations with no
intervening PUT operations always return the same value.
Update

Implemented using HTTP PUT, which modifies an existing resource. PUT should not
be used for resource creation.
Delete

Implemented using HTTP DELETE, which makes the resource inaccessible using the
specified URI. The resource may or may not be physically deleted.
Table 6.5 RESTful service operations
36
© Ian Sommerville 2018:Microservices architecture
• Imagine a system that maintains information about incidents, such as
traffic delays, roadworks and accidents on a national road network. This
system can be accessed via a browser using the URL:
• https://trafficinfo.net/incidents/
• Users can query the system to discover incidents on the roads on which
they are planning to travel.
• When implemented as a RESTful web service, you need to design the
resource structure so that incidents are organized hierarchically.
• For example, incidents may be recorded according to the road identifier (e.g.
A90), the location (e.g. stonehaven), the carriageway direction (e.g. north) and
an incident number (e.g. 1). Therefore, each incident can be accessed using its
URI:
• https://trafficinfo.net/incidents/A90/stonehaven/north/1
Road information system
37
© Ian Sommerville 2018:Microservices architecture
Incident ID: A90N17061714391
Date: 17 June 2017
Time reported: 1439
Severity: Significant
Description: Broken-down bus on north carriageway. One lane closed. Expect
delays of up to 30 minutes
Table 6.6 Incident description
38
© Ian Sommerville 2018:Microservices architecture
• Retrieve
• Returns information about a reported incident or incidents. Accessed using the
GET verb.
• Add
• Adds information about a new incident. Accessed using the POST verb.
• Update
• Updates the information about a reported incident. Accessed using the PUT
verb.
• Delete
• Deletes an incident. The DELETE verb is used when an incident has been
cleared.
Service operations
39
© Ian Sommerville 2018:Microservices architecture
Figure 6.13 HTTP request and response processing
40
HTTP
request
HTTP
response
Service actions
Microservice
Figure 6.13 HTTP request and response processing
Request
processing
Response
generation
© Ian Sommerville 2018:Microservices architecture
Figure 6.14 HTTP request and response message organization
41
[Request header]
[Request body]
REQUEST
[HTTP verb] [URI] [HTTP version]
Figure 6.14 HTTP request and response message organisation
[Response header]
[Response body]
RESPONSE
[Response code][HTTP version]
© Ian Sommerville 2018:Microservices architecture
JSON
{

id: “A90N17061714391”,

“date”: “20170617”,

“time”: “1437”,

“road_id”: “A90”,

“place”: “Stonehaven”,

“direction”: “north”,

“severity”: “significant”,

“description”: “Broken-down bus on north carriageway. One lane closed. Expect
delays of up to 30 minutes.”

}
Table 6.7 XML and JSON descriptions
42
© Ian Sommerville 2018:Microservices architecture
XML
<id>

A90N17061714391

</id>

<date>

20170617

</date>

<time>

1437

</time>

…

<description>Broken-down bus on north carriageway. One lane closed. Expect
delays of up to 30 minutes.

</description>
Table 6.7 XML and JSON descriptions
43
© Ian Sommerville 2018:Microservices architecture
Figure 6.15 A GET request and the associated response
44
REQUEST
GET HTTP/1.1
...
Content-Length: 461
Content-Type: text/json
RESPONSE
HTTP/1.1
Figure 6.15 A GET request and the associated response
200incidents/A90/stonehaven/
Host: trafficinfo.net
...
Accept: text/json, text/xml, text/plain
Content-Length: 0
{
“number”: “A90N17061714391”,
“date”: “20170617”,
“time”: “1437”,
“road_id”: “A90”,
“place”: “Stonehaven”,
“direction”: “north”,
“severity”: “significant”,
“description”: “Broken-down bus on north
carriageway. One lane closed. Expect delays
of up to 30 minutes.”
}
{
“number”: “A90S17061713001”,
“date”: “20170617”,
“time”: “1300”,
“road_id”: “A90”,
“place”: “Stonehaven”,
“direction”: “south”,
“severity”: “minor”,
“description”: “Grass cutting on verge. Minor
delays”
}
© Ian Sommerville 2018:Microservices architecture
• After a system has been developed and delivered, it has to be deployed on
servers, monitored for problems and updated as new versions become
available.
• When a system is composed of tens or even hundreds of microservices,
deployment of the system is more complex than for monolithic systems.
• The service development teams decide which programming language,
database, libraries and other support software should be used to implement
their service. Consequently, there is no ‘standard’ deployment configuration
for all services.
• It is now normal practice for microservice development teams to be
responsible for deployment and service management as well as software
development and to use continuous deployment.
• Continuous deployment means that as soon as a change to a service has
been made and validated, the modified service is redeployed.
Service deployment
45
© Ian Sommerville 2018:Microservices architecture
• Continuous deployment depends on automation so that as soon as a
change is committed, a series of automated activities is triggered to test
the software.
• If the software ‘passes’ these tests, it then enters another automation
pipeline that packages and deploys the software.
• The deployment of a new service version starts with the programmer
committing the code changes to a code management system such as Git.
• This triggers a set of automated tests that run using the modified service.
If all service tests run successfully, a new version of the system that
incorporates the changed service is created.
• Another set of automated system tests are then executed. If these run
successfully, the service is ready for deployment.
Deployment automation
46
© Ian Sommerville 2018:Microservices architecture
Figure 6.16 A continuous deployment pipeline
47
Commit change to
version manage-
ment
Triggers
pass
Reject change Reject change Reject change
Reject change
pass
pass
fail
fail
fail
Figure 6.16 A continuous deployment pipeline
Run unit tests
Containerize
service
Run integration
tests
Build test
system
Replace current
service
Deploy service
container
Run acceptance
tests
fail
pass
© Ian Sommerville 2018:Microservices architecture
Figure 6.17 Versioned services
48
API
gateway cameras
service request
for cameras service
Figure 6.17 Versioned services
current version
link
service
response
cameras service
response
monitor
response
Service
monitor
cameras 001
cameras 002
© Ian Sommerville 2018:Microservices architecture
• A microservice is an independent and self-contained software component
that runs in its own process and communicates with other microservices
using lightweight protocols.
• Microservices in a system can be implemented using different programming
languages and database technologies.
• Microservices have a single responsibility and should be designed so that
they can be easily changed without having to change other microservices in
the system.
• Microservices architecture is an architectural style in which the system is
constructed from communicating microservices. It is well-suited to cloud
based systems where each microservice can run in its own container.
• The two most important responsibilities of architects of a microservices
system are to decide how to structure the system into microservices and to
decide how microservices should communicate and be coordinated.
Key points 1
49
© Ian Sommerville 2018:Microservices architecture
• Communication and coordination decisions include deciding on microservice
communication protocols, data sharing, whether services should be centrally coordinated,
and failure management.
• The RESTful architectural style is widely used in microservice-based systems. Services
are designed so that the HTTP verbs, GET, POST, PUT and DELETE, map onto the
service operations.
• The RESTful style is based on digital resources that, in a microservices architecture, may
be represented using XML or, more commonly, JSON.
• Continuous deployment is a process where new versions of a service are put into
production as soon as a service change has been made. It is a completely automated
process that relies on automated testing to check that the new version is of ‘production
quality’.
• If continuous deployment is used, you may need to maintain multiple versions of deployed
services so that you can switch to an older version if problems are discovered in a newly-
deployed service.
•
Key points 2
50

More Related Content

What's hot

Engineering Software Products: 10. Devops and code management
Engineering Software Products: 10. Devops and code managementEngineering Software Products: 10. Devops and code management
Engineering Software Products: 10. Devops and code managementsoftware-engineering-book
 
Quality Attributes In Software Architecture & Design Patterns
Quality Attributes In Software Architecture & Design PatternsQuality Attributes In Software Architecture & Design Patterns
Quality Attributes In Software Architecture & Design PatternsGatte Ravindranath
 
Ian Sommerville, Software Engineering, 9th Edition Ch 4
Ian Sommerville,  Software Engineering, 9th Edition Ch 4Ian Sommerville,  Software Engineering, 9th Edition Ch 4
Ian Sommerville, Software Engineering, 9th Edition Ch 4Mohammed Romi
 
Lecture04- Use Case Diagrams
Lecture04- Use Case DiagramsLecture04- Use Case Diagrams
Lecture04- Use Case Diagramsartgreen
 
Ch5- Software Engineering 9
Ch5- Software Engineering 9Ch5- Software Engineering 9
Ch5- Software Engineering 9Ian Sommerville
 
User Interface Analysis and Design
User Interface Analysis and DesignUser Interface Analysis and Design
User Interface Analysis and Design Saqib Raza
 
Uml structural diagrams
Uml structural diagramsUml structural diagrams
Uml structural diagramsSwathy T
 
Cloud computing risk assesment presentation
Cloud computing risk assesment presentationCloud computing risk assesment presentation
Cloud computing risk assesment presentationAhmad El Tawil
 
Ch9-Software Engineering 9
Ch9-Software Engineering 9Ch9-Software Engineering 9
Ch9-Software Engineering 9Ian Sommerville
 
Microservice Architecture Software Architecture Microservice Design Pattern
Microservice Architecture Software Architecture Microservice Design PatternMicroservice Architecture Software Architecture Microservice Design Pattern
Microservice Architecture Software Architecture Microservice Design Patternjeetendra mandal
 
Engineering Software Products: 3. features, scenarios and stories
Engineering Software Products: 3. features, scenarios and storiesEngineering Software Products: 3. features, scenarios and stories
Engineering Software Products: 3. features, scenarios and storiessoftware-engineering-book
 
Software myths | Software Engineering Notes
Software myths | Software Engineering NotesSoftware myths | Software Engineering Notes
Software myths | Software Engineering NotesNavjyotsinh Jadeja
 
Software Engineering Process Models
Software Engineering Process Models Software Engineering Process Models
Software Engineering Process Models Satya P. Joshi
 
golden rules of user interface design
golden rules of user interface designgolden rules of user interface design
golden rules of user interface designgadige harshini
 
Quality attributes in software architecture
Quality attributes in software architectureQuality attributes in software architecture
Quality attributes in software architectureHimanshu
 

What's hot (20)

Engineering Software Products: 10. Devops and code management
Engineering Software Products: 10. Devops and code managementEngineering Software Products: 10. Devops and code management
Engineering Software Products: 10. Devops and code management
 
Quality Attributes In Software Architecture & Design Patterns
Quality Attributes In Software Architecture & Design PatternsQuality Attributes In Software Architecture & Design Patterns
Quality Attributes In Software Architecture & Design Patterns
 
Ian Sommerville, Software Engineering, 9th Edition Ch 4
Ian Sommerville,  Software Engineering, 9th Edition Ch 4Ian Sommerville,  Software Engineering, 9th Edition Ch 4
Ian Sommerville, Software Engineering, 9th Edition Ch 4
 
Presentation on uml
Presentation on umlPresentation on uml
Presentation on uml
 
Lecture04- Use Case Diagrams
Lecture04- Use Case DiagramsLecture04- Use Case Diagrams
Lecture04- Use Case Diagrams
 
Ch5- Software Engineering 9
Ch5- Software Engineering 9Ch5- Software Engineering 9
Ch5- Software Engineering 9
 
User Interface Analysis and Design
User Interface Analysis and DesignUser Interface Analysis and Design
User Interface Analysis and Design
 
Uml structural diagrams
Uml structural diagramsUml structural diagrams
Uml structural diagrams
 
Cloud computing risk assesment presentation
Cloud computing risk assesment presentationCloud computing risk assesment presentation
Cloud computing risk assesment presentation
 
Analysis modeling
Analysis modelingAnalysis modeling
Analysis modeling
 
Monolithic architecture
Monolithic architectureMonolithic architecture
Monolithic architecture
 
documentation-testing.ppt
documentation-testing.pptdocumentation-testing.ppt
documentation-testing.ppt
 
Ch9-Software Engineering 9
Ch9-Software Engineering 9Ch9-Software Engineering 9
Ch9-Software Engineering 9
 
Microservice Architecture Software Architecture Microservice Design Pattern
Microservice Architecture Software Architecture Microservice Design PatternMicroservice Architecture Software Architecture Microservice Design Pattern
Microservice Architecture Software Architecture Microservice Design Pattern
 
Engineering Software Products: 3. features, scenarios and stories
Engineering Software Products: 3. features, scenarios and storiesEngineering Software Products: 3. features, scenarios and stories
Engineering Software Products: 3. features, scenarios and stories
 
Software myths | Software Engineering Notes
Software myths | Software Engineering NotesSoftware myths | Software Engineering Notes
Software myths | Software Engineering Notes
 
Software Engineering Process Models
Software Engineering Process Models Software Engineering Process Models
Software Engineering Process Models
 
golden rules of user interface design
golden rules of user interface designgolden rules of user interface design
golden rules of user interface design
 
Quality attributes in software architecture
Quality attributes in software architectureQuality attributes in software architecture
Quality attributes in software architecture
 
Ch5 system modeling
Ch5 system modelingCh5 system modeling
Ch5 system modeling
 

Similar to Engineering Software Products: 6. microservices architecture

6. Microservices architecture.pptx
6. Microservices architecture.pptx6. Microservices architecture.pptx
6. Microservices architecture.pptxdatapro2
 
Overcoming Ongoing Digital Transformational Challenges with a Microservices A...
Overcoming Ongoing Digital Transformational Challenges with a Microservices A...Overcoming Ongoing Digital Transformational Challenges with a Microservices A...
Overcoming Ongoing Digital Transformational Challenges with a Microservices A...Cognizant
 
Get the Message Across: Seamlessly Transport Data to Apps, Anywhere
Get the Message Across: Seamlessly Transport Data to Apps, AnywhereGet the Message Across: Seamlessly Transport Data to Apps, Anywhere
Get the Message Across: Seamlessly Transport Data to Apps, AnywhereVMware Tanzu
 
MICROSERVICES ARCHITECTURE unit -2.pptx
MICROSERVICES ARCHITECTURE unit -2.pptxMICROSERVICES ARCHITECTURE unit -2.pptx
MICROSERVICES ARCHITECTURE unit -2.pptxMohammedShahid562503
 
apidays LIVE Hong Kong 2021 - Modernizing Monolith Applications with API Arch...
apidays LIVE Hong Kong 2021 - Modernizing Monolith Applications with API Arch...apidays LIVE Hong Kong 2021 - Modernizing Monolith Applications with API Arch...
apidays LIVE Hong Kong 2021 - Modernizing Monolith Applications with API Arch...apidays
 
Microservices Tutorial for Beginners | All You Need to Get Started
Microservices Tutorial for Beginners | All You Need to Get StartedMicroservices Tutorial for Beginners | All You Need to Get Started
Microservices Tutorial for Beginners | All You Need to Get StartedShailendra Chauhan
 
Micro services overview
Micro services overviewMicro services overview
Micro services overviewZeeshan Khan
 
IBM Z for the Digital Enterprise - Microservices, APIs
IBM Z for the Digital Enterprise - Microservices, APIsIBM Z for the Digital Enterprise - Microservices, APIs
IBM Z for the Digital Enterprise - Microservices, APIsDevOps for Enterprise Systems
 
CWIN17 Utrecht / cg u services - frank van der wal
CWIN17 Utrecht / cg u services - frank van der walCWIN17 Utrecht / cg u services - frank van der wal
CWIN17 Utrecht / cg u services - frank van der walCapgemini
 
SMART ASSIST SERVICE AT YOUR DOOR STEPS
SMART ASSIST SERVICE AT YOUR DOOR STEPSSMART ASSIST SERVICE AT YOUR DOOR STEPS
SMART ASSIST SERVICE AT YOUR DOOR STEPSIRJET Journal
 
MuCon 2015 - Microservices in Integration Architecture
MuCon 2015 - Microservices in Integration ArchitectureMuCon 2015 - Microservices in Integration Architecture
MuCon 2015 - Microservices in Integration ArchitectureKim Clark
 
DevOps-training-in-chandigarh-Join-now--
DevOps-training-in-chandigarh-Join-now--DevOps-training-in-chandigarh-Join-now--
DevOps-training-in-chandigarh-Join-now--asmeerana605
 
Microservices in Practice
Microservices in PracticeMicroservices in Practice
Microservices in PracticeKasun Indrasiri
 
Design - Start Your API Journey Today
Design - Start Your API Journey TodayDesign - Start Your API Journey Today
Design - Start Your API Journey TodayLaurenWendler
 
APIdays Paris 2019 - Cloud native API Management for Microservices on a Servi...
APIdays Paris 2019 - Cloud native API Management for Microservices on a Servi...APIdays Paris 2019 - Cloud native API Management for Microservices on a Servi...
APIdays Paris 2019 - Cloud native API Management for Microservices on a Servi...apidays
 
Microservices with mule
Microservices with muleMicroservices with mule
Microservices with muleGovind Mulinti
 

Similar to Engineering Software Products: 6. microservices architecture (20)

6. Microservices architecture.pptx
6. Microservices architecture.pptx6. Microservices architecture.pptx
6. Microservices architecture.pptx
 
Overcoming Ongoing Digital Transformational Challenges with a Microservices A...
Overcoming Ongoing Digital Transformational Challenges with a Microservices A...Overcoming Ongoing Digital Transformational Challenges with a Microservices A...
Overcoming Ongoing Digital Transformational Challenges with a Microservices A...
 
Micro Services
Micro ServicesMicro Services
Micro Services
 
Get the Message Across: Seamlessly Transport Data to Apps, Anywhere
Get the Message Across: Seamlessly Transport Data to Apps, AnywhereGet the Message Across: Seamlessly Transport Data to Apps, Anywhere
Get the Message Across: Seamlessly Transport Data to Apps, Anywhere
 
MICROSERVICES ARCHITECTURE unit -2.pptx
MICROSERVICES ARCHITECTURE unit -2.pptxMICROSERVICES ARCHITECTURE unit -2.pptx
MICROSERVICES ARCHITECTURE unit -2.pptx
 
apidays LIVE Hong Kong 2021 - Modernizing Monolith Applications with API Arch...
apidays LIVE Hong Kong 2021 - Modernizing Monolith Applications with API Arch...apidays LIVE Hong Kong 2021 - Modernizing Monolith Applications with API Arch...
apidays LIVE Hong Kong 2021 - Modernizing Monolith Applications with API Arch...
 
Microservices
MicroservicesMicroservices
Microservices
 
Microservices Tutorial for Beginners | All You Need to Get Started
Microservices Tutorial for Beginners | All You Need to Get StartedMicroservices Tutorial for Beginners | All You Need to Get Started
Microservices Tutorial for Beginners | All You Need to Get Started
 
Micro services overview
Micro services overviewMicro services overview
Micro services overview
 
IBM Z for the Digital Enterprise - Microservices, APIs
IBM Z for the Digital Enterprise - Microservices, APIsIBM Z for the Digital Enterprise - Microservices, APIs
IBM Z for the Digital Enterprise - Microservices, APIs
 
Microservices: Detailed Guide
Microservices: Detailed GuideMicroservices: Detailed Guide
Microservices: Detailed Guide
 
CWIN17 Utrecht / cg u services - frank van der wal
CWIN17 Utrecht / cg u services - frank van der walCWIN17 Utrecht / cg u services - frank van der wal
CWIN17 Utrecht / cg u services - frank van der wal
 
SMART ASSIST SERVICE AT YOUR DOOR STEPS
SMART ASSIST SERVICE AT YOUR DOOR STEPSSMART ASSIST SERVICE AT YOUR DOOR STEPS
SMART ASSIST SERVICE AT YOUR DOOR STEPS
 
MuCon 2015 - Microservices in Integration Architecture
MuCon 2015 - Microservices in Integration ArchitectureMuCon 2015 - Microservices in Integration Architecture
MuCon 2015 - Microservices in Integration Architecture
 
DevOps-training-in-chandigarh-Join-now--
DevOps-training-in-chandigarh-Join-now--DevOps-training-in-chandigarh-Join-now--
DevOps-training-in-chandigarh-Join-now--
 
Microservices in Practice
Microservices in PracticeMicroservices in Practice
Microservices in Practice
 
Design - Start Your API Journey Today
Design - Start Your API Journey TodayDesign - Start Your API Journey Today
Design - Start Your API Journey Today
 
Microservice's in detailed
Microservice's in detailedMicroservice's in detailed
Microservice's in detailed
 
APIdays Paris 2019 - Cloud native API Management for Microservices on a Servi...
APIdays Paris 2019 - Cloud native API Management for Microservices on a Servi...APIdays Paris 2019 - Cloud native API Management for Microservices on a Servi...
APIdays Paris 2019 - Cloud native API Management for Microservices on a Servi...
 
Microservices with mule
Microservices with muleMicroservices with mule
Microservices with mule
 

More from software-engineering-book

Engineering Software Products: 1. software products
Engineering Software Products: 1. software productsEngineering Software Products: 1. software products
Engineering Software Products: 1. software productssoftware-engineering-book
 

More from software-engineering-book (20)

Engineering Software Products: 1. software products
Engineering Software Products: 1. software productsEngineering Software Products: 1. software products
Engineering Software Products: 1. software products
 
Ch25 configuration management
Ch25 configuration managementCh25 configuration management
Ch25 configuration management
 
Ch24 quality management
Ch24 quality managementCh24 quality management
Ch24 quality management
 
Ch23 project planning
Ch23 project planningCh23 project planning
Ch23 project planning
 
Ch22 project management
Ch22 project managementCh22 project management
Ch22 project management
 
Ch21 real time software engineering
Ch21 real time software engineeringCh21 real time software engineering
Ch21 real time software engineering
 
Ch20 systems of systems
Ch20 systems of systemsCh20 systems of systems
Ch20 systems of systems
 
Ch19 systems engineering
Ch19 systems engineeringCh19 systems engineering
Ch19 systems engineering
 
Ch18 service oriented software engineering
Ch18 service oriented software engineeringCh18 service oriented software engineering
Ch18 service oriented software engineering
 
Ch17 distributed software engineering
Ch17 distributed software engineeringCh17 distributed software engineering
Ch17 distributed software engineering
 
Ch16 component based software engineering
Ch16 component based software engineeringCh16 component based software engineering
Ch16 component based software engineering
 
Ch15 software reuse
Ch15 software reuseCh15 software reuse
Ch15 software reuse
 
Ch14 resilience engineering
Ch14 resilience engineeringCh14 resilience engineering
Ch14 resilience engineering
 
Ch13 security engineering
Ch13 security engineeringCh13 security engineering
Ch13 security engineering
 
Ch12 safety engineering
Ch12 safety engineeringCh12 safety engineering
Ch12 safety engineering
 
Ch11 reliability engineering
Ch11 reliability engineeringCh11 reliability engineering
Ch11 reliability engineering
 
Ch10 dependable systems
Ch10 dependable systemsCh10 dependable systems
Ch10 dependable systems
 
Ch9 evolution
Ch9 evolutionCh9 evolution
Ch9 evolution
 
Ch8.testing
Ch8.testingCh8.testing
Ch8.testing
 
Ch7 implementation
Ch7 implementationCh7 implementation
Ch7 implementation
 

Recently uploaded

WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 

Recently uploaded (20)

WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 

Engineering Software Products: 6. microservices architecture

  • 1. © Ian Sommerville 2018 Chapter 6 Microservices architecture
  • 2. © Ian Sommerville 2018:Microservices architecture • A software service is a software component that can be accessed from remote computers over the Internet. Given an input, a service produces a corresponding output, without side effects. • The service is accessed through its published interface and all details of the service implementation are hidden. • Services do not maintain any internal state. State information is either stored in a database or is maintained by the service requestor. • When a service request is made, the state information may be included as part of the request and the updated state information is returned as part of the service result. • As there is no local state, services can be dynamically reallocated from one virtual server to another and replicated across several servers. Software services 2
  • 3. © Ian Sommerville 2018:Microservices architecture • After various experiments in the 1990s with service-oriented computing, the idea of ‘big’ Web Services emerged in the early 2000s. • These were based on XML-based protocols and standards such as SOAP for service interaction and WSDL for interface description. • Most software services don’t need the generality that’s inherent in the design of web service protocols. • Consequently, modern service-oriented systems, use simpler, ‘lighter weight’ service-interaction protocols that have lower overheads and, consequently, faster execution. Modern web services 3
  • 4. © Ian Sommerville 2018:Microservices architecture • Microservices are small-scale, stateless, services that have a single responsibility. They are combined to create applications. • They are completely independent with their own database and UI management code. • Software products that use microservices have a microservices architecture. • If you need to create cloud-based software products that are adaptable, scaleable and resilient then I recommend that design them around a microservices architecture. Microservices 4
  • 5. © Ian Sommerville 2018:Microservices architecture • System authentication • User registration, where users provide information about their identity, security information, mobile (cell) phone number and email address. • Authentication using UID/password. • Two-factor authentication using code sent to mobile phone. • User information management e.g. change password or mobile phone number. • Reset forgotten password. • Each of these features could be implemented as a separate service that uses a central shared database to hold authentication information. • However, these features are too large to be microservices. To identify the microservices that might be used in the authentication system, you need to break down the coarse-grain features into more detailed functions. A microservice example 5
  • 6. © Ian Sommerville 2018:Microservices architecture Figure 6.1 Functional breakdown of authentication features 6 User registration Setup new login id Setup new password Setup password recovery information Setup two-factor authentication Confirm registration Authenticate using UID/password Get login id Get password Check credentials Confirm authentication Figure 6.1 Functional breakdown of authentication features
  • 7. © Ian Sommerville 2018:Microservices architecture Figure 6.2 Authentication microservices 7 UID management Password management User info management UID data Password data User data Authentication Figure 6.2 Authentication microservices
  • 8. © Ian Sommerville 2018:Microservices architecture Self-contained
 Microservices do not have external dependencies. They manage their own data and implement their own user interface. Lightweight
 Microservices communicate using lightweight protocols, so that service communication overheads are low. Implementation-independent
 Microservices may be implemented using different programming languages and may use different technologies (e.g. different types of database) in their implementation. Independently deployable
 Each microservice runs in its own process and is independently deployable, using automated systems. Business-oriented
 Microservices should implement business capabilities and needs, rather than simply provide a technical service. Table 6.1 Characteristics of microservices 8
  • 9. © Ian Sommerville 2018:Microservices architecture • Microservices communicate by exchanging messages. • A message that is sent between services includes some administrative information, a service request and the data required to deliver the requested service. • Services return a response to service request messages. • An authentication service may send a message to a login service that includes the name input by the user. • The response may be a token associated with a valid user name or might be an error saying that there is no registered user. Microservice communication 9
  • 10. © Ian Sommerville 2018:Microservices architecture • A well-designed microservice should have high cohesion and low coupling. • Cohesion is a measure of the number of relationships that parts of a component have with each other. High cohesion means that all of the parts that are needed to deliver the component’s functionality are included in the component. • Coupling is a measure of the number of relationships that one component has with other components in the system. Low coupling means that components do not have many relationships with other components. • Each microservice should have a single responsibility i.e. it should do one thing only and it should do it well. • However, ‘one thing only’ is difficult to define in a way that’s applicable to all services. • Responsibility does not always mean a single, functional activity. Microservice characteristics 10
  • 11. © Ian Sommerville 2018:Microservices architecture Figure 6.3 Password management functionality 11 Figure 6.3 Password management functionality User functions Create password Change password Check password Recover password Supporting functions Check password validity Delete password Backup password database Recover password database Check database integrity Repair password DB
  • 12. © Ian Sommerville 2018:Microservices architecture Figure 6.4 Microservice support code 12 Microservice X Service functionality Message management UI implementation Failure management Data consistency management Figure 6.4 Microservice support code
  • 13. © Ian Sommerville 2018:Microservices architecture • A microservices architecture is an architectural style – a tried and tested way of implementing a logical software architecture. • This architectural style addresses two problems with monolithic applications • The whole system has to be rebuilt, re-tested and re-deployed when any change is made. This can be a slow process as changes to one part of the system can adversely affect other components. • As the demand on the system increases, the whole system has to be scaled, even if the demand is localized to a small number of system components that implement the most popular system functions. Microservices architecture 13
  • 14. © Ian Sommerville 2018:Microservices architecture • Microservices are self-contained and run in separate processes. • In cloud-based systems, each microservice may be deployed in its own container. This means a microservice can be stopped and restarted without affecting other parts of the system. • If the demand on a service increases, service replicas can be quickly created and deployed. These do not require a more powerful server so ‘scaling-out’ is, typically, much cheaper than ’scaling up’. • Benefits of microservices architecture 14
  • 15. © Ian Sommerville 2018:Microservices architecture Imagine that you are developing a photo printing service for mobile devices. Users can upload photos to your server from their phone or specify photos from their Instagram account that they would like to be printed. Prints can be made at different sizes and on different media. Users can chose print size and print medium. For example, they may decide to print a picture onto a mug or a T-shirt. The prints or other media are prepared and then posted to their home. They pay for prints either using a payment service such as Android or Apple Pay or by registering a credit card with the printing service provider. Table 6.2 A photo printing system for mobile devices 15
  • 16. © Ian Sommerville 2018:Microservices architecture Figure 6.5 A microservices architecture for a photo printing system 16 Mobile app API gateway Authentication Figure 6.5 A microservices architecture for a photo printing system SERVICES Registration Upload Payment Printing Despatch
  • 17. © Ian Sommerville 2018:Microservices architecture Figure 6.6 Microservices architecture - key design questions 17 What are the microservices that make up the system? How should microservices communicate with each other? How should the microservices in the system be coordinated? How should service failure be detected, reported and managed? How should data be distributed and shared? Microservices architecture design Figure 6.6 Microservices architecture - key design questions
  • 18. © Ian Sommerville 2018:Microservices architecture • Balance fine-grain functionality and system performance • Single-function services mean that changes are limited to fewer services but require service communications to implement user functionality. This slows down a system because of the need for each service to bundle and unbundle messages sent from other services. • Follow the ‘common closure principle’ • Elements of a system that are likely to be changed at the same time should be located within the same service. Most new and changed requirements should therefore only affect a single service. • Associate services with business capabilities • A business capability is a discrete area of business functionality that is the responsibility of an individual or a group. You should identify the services that are required to support each business capability. • Design services so that they only have access to the data that they need • If there is an overlap between the data used by different services, you need a mechanism to propagate data changes to all services using the same data. Decomposition guidelines 18
  • 19. © Ian Sommerville 2018:Microservices architecture • Services communicate by exchanging messages that include information about the originator of the message, as well as the data that is the input to or output from the request. • When you are designing a microservices architecture, you have to establish a standard for communications that all microservices should follow. Some of the key decisions that you have to make are • should service interaction be synchronous or asynchronous? • should services communicate directly or via message broker middleware? • what protocol should be used for messages exchanged between services? Service communications 19
  • 20. © Ian Sommerville 2018:Microservices architecture Figure 6.7 Synchronous and asynchronous microservice interaction 20 Service A Figure 6.7 Synchronous and asynchronous microservice interaction Calls Returns Requests (B) Synchronous - A waits for B Asynchronous - A and B execute concurrently Queue B Queue A Requests (A) Service B Service A Processing Waiting Processing Processing Processing Processing Processing ProcessingProcessing Service B
  • 21. © Ian Sommerville 2018:Microservices architecture • In a synchronous interaction, service A issues a request to service B. Service A then suspends processing while B is processing the request. • It waits until service B has returned the required information before continuing execution. • In an asynchronous interaction, service A issues the request that is queued for processing by service B. A then continues processing without waiting for B to finish its computations. • Sometime later, service B completes the earlier request from service A and queues the result to be retrieved by A. • Service A, therefore, has to check its queue periodically to see if a result is available. • Synchronous and asynchronous interaction 21
  • 22. © Ian Sommerville 2018:Microservices architecture Figure 6.8 Direct and indirect service communication 22 Figure 6.8 Direct and indirect service communication Direct communication - A and B send messages to each other Indirect communication - A and B communicate through a message broker Message broker Service A Service B Service A Service B
  • 23. © Ian Sommerville 2018:Microservices architecture • Direct service communication requires that interacting services know each other’s address. • The services interact by sending requests directly to these addresses. • Indirect communication involves naming the service that is required and sending that request to a message broker (sometimes called a message bus). • The message broker is then responsible for finding the service that can fulfil the service request. Direct and indirect service communication 23
  • 24. © Ian Sommerville 2018:Microservices architecture • You should isolate data within each system service with as little data sharing as possible. • If data sharing is unavoidable, you should design microservices so that most sharing is ‘read-only’, with a minimal number of services responsible for data updates. • If services are replicated in your system, you must include a mechanism that can keep the database copies used by replica services consistent. Microservice data design 24
  • 25. © Ian Sommerville 2018:Microservices architecture • An ACID transaction bundles a set of data updates into a single unit so that either all updates are completed or none of them are. ACID transactions are impractical in a microservices architecture. • The databases used by different microservices or microservice replicas need not be completely consistent all of the time. • Dependent data inconsistency • The actions or failures of one service can cause the data managed by another service to become inconsistent. • Replica inconsistency • There are several replicas of the same service that are executing concurrently. These all have their own database copy and each updates its own copy of the service data. You need a way of making these databases ‘eventually consistent’ so that all replicas are working on the same data. Inconsistency management 25
  • 26. © Ian Sommerville 2018:Microservices architecture • Eventual consistency is a situation where the system guarantees that the databases will eventually become consistent. • You can implement eventual consistency by maintaining a transaction log. • When a database change is made, this is recorded on a ‘pending updates’ log. • Other service instances look at this log, update their own database and indicate that they have made the change. Eventual consistency 26
  • 27. © Ian Sommerville 2018:Microservices architecture Figure 6.9 Using a pending transaction log 27 Pending transactions log A1/DB update 1 A1/DB update 2 A2/DB update 1 Figure 6.9 Using a pending transactions log Service A1 Database A Service A2 Database A
  • 28. © Ian Sommerville 2018:Microservices architecture • Most user sessions involve a series of interactions in which operations have to be carried out in a specific order. • This is called a workflow. • An authentication workflow for UID/password authentication shows the steps involved in authenticating a user. • In this example, the user is allowed 3 login attempts before the system indicates that the login has failed. Service coordination 28
  • 29. © Ian Sommerville 2018:Microservices architecture Figure 6.10 Authentication workflow 29 End Retry login Get login Start End Check login Get password Check password Indicate failure login OK login invalid password OK password invalid attempts > 3 attempts = 1 authfail = F authfail=T Figure 6.10 Authentication workflow authfail = F Increment attempts attempts <= 3 authfail = T authfail=F
  • 30. © Ian Sommerville 2018:Microservices architecture Figure 6.11 Orchestration and choreography 30 Authentication controller Service orchestration Service choreography Figure 6.11 Orchestration and choreography Authentication eventsLogin service Password service Login service Password service
  • 31. © Ian Sommerville 2018:Microservices architecture Internal service failure
 These are conditions that are detected by the service and can be reported to the service client in an error message. An example of this type of failure is a service that takes a URL as an input and discovers that this is an invalid link. External service failure
 These failures have an external cause, which affects the availability of a service. Failure may cause the service to become unresponsive and actions have to be taken to restart the service. Service performance failure
 The performance of the service degrades to an unacceptable level. This may be due to a heavy load or an internal problem with the service. External service monitoring can be used to detect performance failures and unresponsive services. Table 6.3 Failure types in a microservices system 31
  • 32. © Ian Sommerville 2018:Microservices architecture • A timeout is a counter that this associated with the service requests and starts running when the request is made. • Once the counter reaches some predefined value, such as 10 seconds, the calling service assumes that the service request has failed and acts accordingly. • The problem with the timeout approach is that every service call to a ‘failed service’ is delayed by the timeout value so the whole system slows down. • Instead of using timeouts explicitly when a service call is made, he suggests using a circuit breaker. Like an electrical circuit breaker, this immediately denies access to a failed service without the delays associated with timeouts. Timeouts and circuit breakers 32
  • 33. © Ian Sommerville 2018:Microservices architecture Figure 6.12 Using a circuit breaker to cope with service failure 33 Circuit breaker Check S2 availability retries>3 retries<=3 timeout ok timeout fail S2 available S2 unavailable Figure 6.12 Using a circuit breaker to cope with service failure Service S1 Service S2 Set timeout Route service request Respond S2 unavailable Set S2 unavailable Route service response Increment retries Check timeout
  • 34. © Ian Sommerville 2018:Microservices architecture • The REST (REpresentational State Transfer) architectural style is based on the idea of transferring representations of digital resources from a server to a client. • You can think of a resource as any chunk of data such as credit card details, an individual’s medical record, a magazine or newspaper, a library catalogue, and so on. • Resources are accessed via their unique URI and RESTful services operate on these resources. • This is the fundamental approach used in the web where the resource is a page to be displayed in the user’s browser. • An HTML representation is generated by the server in response to an HTTP GET request and is transferred to the client for display by a browser or a special-purpose app. RESTful services 34
  • 35. © Ian Sommerville 2018:Microservices architecture Use HTTP verbs
 The basic methods defined in the HTTP protocol (GET, PUT, POST, DELETE) must be used to access the operations made available by the service. Stateless services
 Services must never maintain internal state. As I have already explained, microservices are stateless so fit with this principle. URI addressable
 All resources must have a URI, with a hierarchical structure, that is used to access sub-resources. Use XML or JSON
 Resources should normally be represented in JSON or XML or both. Other representations, such as audio and video representations, may be used if appropriate. Table 6.4 RESTful service principles 35
  • 36. © Ian Sommerville 2018:Microservices architecture Create
 Implemented using HTTP POST, which creates the resource with the given URI. If the resource has already been created, an error is returned. Read
 Implemented using HTTP GET, which reads the resource and returns its value. GET operations should never update a resource so that successive GET operations with no intervening PUT operations always return the same value. Update
 Implemented using HTTP PUT, which modifies an existing resource. PUT should not be used for resource creation. Delete
 Implemented using HTTP DELETE, which makes the resource inaccessible using the specified URI. The resource may or may not be physically deleted. Table 6.5 RESTful service operations 36
  • 37. © Ian Sommerville 2018:Microservices architecture • Imagine a system that maintains information about incidents, such as traffic delays, roadworks and accidents on a national road network. This system can be accessed via a browser using the URL: • https://trafficinfo.net/incidents/ • Users can query the system to discover incidents on the roads on which they are planning to travel. • When implemented as a RESTful web service, you need to design the resource structure so that incidents are organized hierarchically. • For example, incidents may be recorded according to the road identifier (e.g. A90), the location (e.g. stonehaven), the carriageway direction (e.g. north) and an incident number (e.g. 1). Therefore, each incident can be accessed using its URI: • https://trafficinfo.net/incidents/A90/stonehaven/north/1 Road information system 37
  • 38. © Ian Sommerville 2018:Microservices architecture Incident ID: A90N17061714391 Date: 17 June 2017 Time reported: 1439 Severity: Significant Description: Broken-down bus on north carriageway. One lane closed. Expect delays of up to 30 minutes Table 6.6 Incident description 38
  • 39. © Ian Sommerville 2018:Microservices architecture • Retrieve • Returns information about a reported incident or incidents. Accessed using the GET verb. • Add • Adds information about a new incident. Accessed using the POST verb. • Update • Updates the information about a reported incident. Accessed using the PUT verb. • Delete • Deletes an incident. The DELETE verb is used when an incident has been cleared. Service operations 39
  • 40. © Ian Sommerville 2018:Microservices architecture Figure 6.13 HTTP request and response processing 40 HTTP request HTTP response Service actions Microservice Figure 6.13 HTTP request and response processing Request processing Response generation
  • 41. © Ian Sommerville 2018:Microservices architecture Figure 6.14 HTTP request and response message organization 41 [Request header] [Request body] REQUEST [HTTP verb] [URI] [HTTP version] Figure 6.14 HTTP request and response message organisation [Response header] [Response body] RESPONSE [Response code][HTTP version]
  • 42. © Ian Sommerville 2018:Microservices architecture JSON {
 id: “A90N17061714391”,
 “date”: “20170617”,
 “time”: “1437”,
 “road_id”: “A90”,
 “place”: “Stonehaven”,
 “direction”: “north”,
 “severity”: “significant”,
 “description”: “Broken-down bus on north carriageway. One lane closed. Expect delays of up to 30 minutes.”
 } Table 6.7 XML and JSON descriptions 42
  • 43. © Ian Sommerville 2018:Microservices architecture XML <id>
 A90N17061714391
 </id>
 <date>
 20170617
 </date>
 <time>
 1437
 </time>
 …
 <description>Broken-down bus on north carriageway. One lane closed. Expect delays of up to 30 minutes.
 </description> Table 6.7 XML and JSON descriptions 43
  • 44. © Ian Sommerville 2018:Microservices architecture Figure 6.15 A GET request and the associated response 44 REQUEST GET HTTP/1.1 ... Content-Length: 461 Content-Type: text/json RESPONSE HTTP/1.1 Figure 6.15 A GET request and the associated response 200incidents/A90/stonehaven/ Host: trafficinfo.net ... Accept: text/json, text/xml, text/plain Content-Length: 0 { “number”: “A90N17061714391”, “date”: “20170617”, “time”: “1437”, “road_id”: “A90”, “place”: “Stonehaven”, “direction”: “north”, “severity”: “significant”, “description”: “Broken-down bus on north carriageway. One lane closed. Expect delays of up to 30 minutes.” } { “number”: “A90S17061713001”, “date”: “20170617”, “time”: “1300”, “road_id”: “A90”, “place”: “Stonehaven”, “direction”: “south”, “severity”: “minor”, “description”: “Grass cutting on verge. Minor delays” }
  • 45. © Ian Sommerville 2018:Microservices architecture • After a system has been developed and delivered, it has to be deployed on servers, monitored for problems and updated as new versions become available. • When a system is composed of tens or even hundreds of microservices, deployment of the system is more complex than for monolithic systems. • The service development teams decide which programming language, database, libraries and other support software should be used to implement their service. Consequently, there is no ‘standard’ deployment configuration for all services. • It is now normal practice for microservice development teams to be responsible for deployment and service management as well as software development and to use continuous deployment. • Continuous deployment means that as soon as a change to a service has been made and validated, the modified service is redeployed. Service deployment 45
  • 46. © Ian Sommerville 2018:Microservices architecture • Continuous deployment depends on automation so that as soon as a change is committed, a series of automated activities is triggered to test the software. • If the software ‘passes’ these tests, it then enters another automation pipeline that packages and deploys the software. • The deployment of a new service version starts with the programmer committing the code changes to a code management system such as Git. • This triggers a set of automated tests that run using the modified service. If all service tests run successfully, a new version of the system that incorporates the changed service is created. • Another set of automated system tests are then executed. If these run successfully, the service is ready for deployment. Deployment automation 46
  • 47. © Ian Sommerville 2018:Microservices architecture Figure 6.16 A continuous deployment pipeline 47 Commit change to version manage- ment Triggers pass Reject change Reject change Reject change Reject change pass pass fail fail fail Figure 6.16 A continuous deployment pipeline Run unit tests Containerize service Run integration tests Build test system Replace current service Deploy service container Run acceptance tests fail pass
  • 48. © Ian Sommerville 2018:Microservices architecture Figure 6.17 Versioned services 48 API gateway cameras service request for cameras service Figure 6.17 Versioned services current version link service response cameras service response monitor response Service monitor cameras 001 cameras 002
  • 49. © Ian Sommerville 2018:Microservices architecture • A microservice is an independent and self-contained software component that runs in its own process and communicates with other microservices using lightweight protocols. • Microservices in a system can be implemented using different programming languages and database technologies. • Microservices have a single responsibility and should be designed so that they can be easily changed without having to change other microservices in the system. • Microservices architecture is an architectural style in which the system is constructed from communicating microservices. It is well-suited to cloud based systems where each microservice can run in its own container. • The two most important responsibilities of architects of a microservices system are to decide how to structure the system into microservices and to decide how microservices should communicate and be coordinated. Key points 1 49
  • 50. © Ian Sommerville 2018:Microservices architecture • Communication and coordination decisions include deciding on microservice communication protocols, data sharing, whether services should be centrally coordinated, and failure management. • The RESTful architectural style is widely used in microservice-based systems. Services are designed so that the HTTP verbs, GET, POST, PUT and DELETE, map onto the service operations. • The RESTful style is based on digital resources that, in a microservices architecture, may be represented using XML or, more commonly, JSON. • Continuous deployment is a process where new versions of a service are put into production as soon as a service change has been made. It is a completely automated process that relies on automated testing to check that the new version is of ‘production quality’. • If continuous deployment is used, you may need to maintain multiple versions of deployed services so that you can switch to an older version if problems are discovered in a newly- deployed service. • Key points 2 50