Microservices Architecture and Microsoft Azure Integration

 
Microservices?
 
Anton Boyko
Microsoft Azure MVP
Ninja Azure Consultant
boyko.ant@live.com
Agenda
 
What and why?
What is microservice architecture approach and why
should I care?
Several examples
Several examples of microservice architecture from
real life projects
Implementation checklist
Several important points you need to consider while
planning your microservice architecture
What about Azure?
What Microsoft Azure can offer for my microservices?
 
WHAT AND WHY?
 
Criteria
 
Spaghetti
 
$conn
 = 
new
 
mysqli
(
$servername
, 
$username
, 
$password
, 
$dbname
);
if
 (
$conn
->
connect_error
) {
    die
(
"Connection failed: "
 . 
$conn
->
connect_error
);
}
$sql
 = 
"
SELECT
 firstname, lastname 
FROM
 users"
;
$result
 = 
$conn
->query(
$sql
);
if
 (
$result
->
num_rows
 > 
0
) {
    echo
 
"<table>"
;
    while
(
$row
 = 
$result
->fetch_assoc()) {
        echo
 
"<tr><td>"
;
        echo
 
$row
[
"firstname"
] . 
"</td><td>"
 . 
$row
[
"lastname"
];
        echo
 
"</td></tr>"
;
    }
    echo
 
"</table>"
;
} 
else
 {
    echo
 
"0 results"
;
}
$conn
->close();
Spaghetti
 
Monolith
 
Application in which user interface and data
access code are combined into a single
program.
Design philosophy is that the application is
responsible not just for a particular task, but
can perform every step needed to complete a
particular function.
Monolith
Solution
Presentation
Application
Data
Server
Solution
Server
Solution
Server
Solution
NLB
Monolith
 
Microservices
 
Microservices is a variant of the service-
oriented architecture (SOA) architectural style
that structures an application as a collection
of loosely coupled services.
Microservices should be fine-grained and
protocols should be lightweight.
Application is easier to understand, develop
and test.
Microservices
Microservice 1
Presentation
Application
Data
Microservice 2
Application
Data
Microservice 3
Presentation
Server
Server
Server
NLB
Microservices
 
Nanoservices
 
Nanoservices is a microservices anti-pattern
where each service is too fine grained.
Nanoservice is a service whose overhead
(communications, maintenance etc.)
outweighs its utility.
 
Nanoservices
User login
Presentation
Application
Data
User register
Presentation
Application
Data
Get categories
Presentation
Application
Data
Add category
Presentation
Application
Data
Get goods
Presentation
Application
Data
Get good by id
Presentation
Application
Data
Get my orders
Presentation
Application
Data
Create order
Presentation
Application
Data
Nanoservices
 
 
SEVERAL EXAMPLES
 
 
Online shop
 
Community portal
 
IMPLEMENTATION CHECKLIST
 
Infrastructure components
 
Microservices hosts
Configuration source
Routing and/or autodiscovery engine
Monitoring engine
Logging engine
CQRS
 
Synchronous queries
send request and wait for response with data
it’s acceptable to join data on a client side
Asynchronous commands
send request and wait for command unique id
use command id to check execution status
handling distributed transactions that affect
several microservices can be tricky
commands should be idempotent
 
CAP theorem
Eventual consistency
 
After command for data modification was
received, it may take some time for new data to
be available for querying
Client
app
API
DB
Client
cache
 
write entity
 
id = 42
 
write [ 42 ]
Eventual consistency
After command for data modification was
received, it may take some time for new data to
be available for querying
Client
app
API
DB
Client
cache
 
read list
 
[ 1, 20, 50, … ]
 
read [ 42, 60 ]
Eventual consistency
After command for data modification was
received, it may take some time for new data to
be available for querying
Client
app
API
DB
Client
cache
 
read list
 
[ 1, 20, 42, 50, … ]
 
read [ 60 ]
remove [ 42 ]
 
WHAT ABOUT AZURE?
 
Azure Service Fabric
 
Service Fabric itself is platform agnostic
Stateless and statefull services
Service discovery
Health monitoring
Fault domains and upgrade domains
Enterprise-ready
https://docs.microsoft.com/en-
us/azure/service-fabric/
Fault and upgrade domains
Azure App Services
 
.NET, Java, PHP, Node.JS, Python
Shared web farm, isolated web apps
Configuration management
Backups
Sticky sessions
Built-in MySQL database
https://docs.microsoft.com/en-us/azure/app-
service-web/
Azure App Services
NLB
Distributed file system
App 1
root
App 2
root
App 5
root
App 4
root
App 3
root
Azure App Services
NLB
Distributed file system
App 1
root
App 2
root
App 5
root
App 4
root
App 3
root
Azure Functions
 
Built on top of Azure App Services
Small and independent unit of work
Designed for handling huge amount of small
parallel independent executions
Consider them as event handlers
Triggers and bindings
Can be chained to handle sequential workflow
Dedicated and consumption pricing plans
https://docs.microsoft.com/en-
us/azure/azure-functions/
 
 
Azure Functions
 
Azure Functions bindings
 
Azure functions quickstart
 
Create cross-platform desktop apps using
JavaScript and Azure
https://www.youtube.com/playlist?list=PLi8ga
rtTlTVx7sKg3XLuCQik1XSgUMNgl
Sql Saturday 2017 Kyiv
https://www.youtube.com/playlist?list=PLi8ga
rtTlTVxR9lGYAXUNTk1Mo0qG1j7i
 
Questions?
 
Anton Boyko
Microsoft Azure MVP
Ninja Azure Consultant
boyko.ant@live.com
Slide Note
Embed
Share

Explore the concept of microservices architecture with real-life examples and implementation checklists. Learn about the benefits of utilizing Microsoft Azure for managing microservices effectively. Dive into the comparison with monolithic applications and the challenges they pose.

  • Microservices
  • Architecture
  • Microsoft Azure
  • Implementation
  • Scalability

Uploaded on Oct 07, 2024 | 1 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Microservices? Anton Boyko Microsoft Azure MVP Ninja Azure Consultant boyko.ant@live.com

  2. Agenda What and why? What is microservice architecture approach and why should I care? Several examples Several examples of microservice architecture from real life projects Implementation checklist Several important points you need to consider while planning your microservice architecture What about Azure? What Microsoft Azure can offer for my microservices?

  3. WHAT AND WHY?

  4. Criteria Maintainability Monitoring Scalability How easy is it to maintain the code? How easy is it to fix a bug? How easy is it to monitor solution health? How easy is it to add new computin power and handle heavier load? Updates Onboarding How easy is it to update solution to the newest version? How easy is it to get onboard a new team member?

  5. Spaghetti $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "SELECT firstname, lastname FROM users"; $result = $conn->query($sql); if ($result->num_rows > 0) { echo "<table>"; while($row = $result->fetch_assoc()) { echo "<tr><td>"; echo $row["firstname"] . "</td><td>" . $row["lastname"]; echo "</td></tr>"; } echo "</table>"; } else { echo "0 results"; } $conn->close();

  6. Spaghetti Maintainability Monitoring Scalability Impossible Almost impossible Sometimes possible Updates Onboarding Requires shutdown Highly demotivating

  7. Monolith Application in which user interface and data access code are combined into a single program. Design philosophy is that the application is responsible not just for a particular task, but can perform every step needed to complete a particular function.

  8. Monolith Solution Presentation Application Data NLB Solution Solution Solution Server Server Server

  9. Monolith Maintainability Monitoring Scalability Mostly possible Highly depends on solution size Possible Mostly possible Updates Onboarding Requires shutdown Possible Highly depends on solution size

  10. Microservices Microservices is a variant of the service- oriented architecture (SOA) architectural style that structures an application as a collection of loosely coupled services. Microservices should be fine-grained and protocols should be lightweight. Application is easier to understand, develop and test.

  11. Microservices Microservice 1 Presentation Application Data NLB Microservice 2 Application Data Microservice 3 Presentation Server Server Server

  12. Microservices Maintainability Monitoring Scalability Possible Possible Highly depends on solution size Possible Updates Onboarding Can be handled without shutdown Highly depends on solution size Possible

  13. Nanoservices Nanoservices is a microservices anti-pattern where each service is too fine grained. Nanoservice is a service whose overhead (communications, maintenance etc.) outweighs its utility.

  14. Nanoservices Get my orders User login Get categories Get goods Presentation Presentation Presentation Presentation Application Application Application Application Data Data Data Data Create order User register Add category Get good by id Presentation Presentation Presentation Presentation Application Application Application Application Data Data Data Data

  15. Nanoservices Maintainability Monitoring Scalability Almost impossible Almost impossible Possible Updates Onboarding Can be handled without shutdown Extremely depends on solution size Sometimes possible

  16. SEVERAL EXAMPLES

  17. Online shop Identity Client Profile Admin Search Data Ad Social

  18. Community portal Web Admin Rendering Identity Member Data Notification Speaker

  19. IMPLEMENTATION CHECKLIST

  20. Infrastructure components Microservices hosts Configuration source Routing and/or autodiscovery engine Monitoring engine Logging engine

  21. CQRS Synchronous queries send request and wait for response with data it s acceptable to join data on a client side Asynchronous commands send request and wait for command unique id use command id to check execution status handling distributed transactions that affect several microservices can be tricky commands should be idempotent

  22. CAP theorem Consistency Availability Partitioning

  23. Eventual consistency After command for data modification was received, it may take some time for new data to be available for querying write entity Client app API DB id = 42 write [ 42 ] Client cache

  24. Eventual consistency After command for data modification was received, it may take some time for new data to be available for querying read list Client app API DB [ 1, 20, 50, ] read [ 42, 60 ] Client cache

  25. Eventual consistency After command for data modification was received, it may take some time for new data to be available for querying read list Client app API DB [ 1, 20, 42, 50, ] read [ 60 ] remove [ 42 ] Client cache

  26. WHAT ABOUT AZURE?

  27. Azure Service Fabric Service Fabric itself is platform agnostic Stateless and statefull services Service discovery Health monitoring Fault domains and upgrade domains Enterprise-ready https://docs.microsoft.com/en- us/azure/service-fabric/

  28. Fault and upgrade domains Fault 1 Fault 2 Fault 3 Fault 4 Fault 5 Update 1 Node 1 Update 2 Node 2 Update 3 Node 3 Update 4 Node 4 Update 5 Node 5 Main Primary reserved Secondary reserved Microservice 1 1 2 3 Microservice 2 2 3 4 Microservice 3 3 4 5 Microservice 4 4 5 1 Microservice 5 5 1 2

  29. Azure App Services .NET, Java, PHP, Node.JS, Python Shared web farm, isolated web apps Configuration management Backups Sticky sessions Built-in MySQL database https://docs.microsoft.com/en-us/azure/app- service-web/

  30. Azure App Services NLB Server 1 Server 2 Server 3 Server 4 CPU RAM CPU RAM CPU RAM CPU RAM App 1 root App 2 root App 3 root App 4 root App 5 root Distributed file system

  31. Azure App Services NLB Server 1 Server 2 Server 3 Server 4 CPU RAM CPU RAM CPU RAM CPU RAM App 1 root App 2 root App 3 root App 4 root App 5 root Distributed file system

  32. Azure Functions Built on top of Azure App Services Small and independent unit of work Designed for handling huge amount of small parallel independent executions Consider them as event handlers Triggers and bindings Can be chained to handle sequential workflow Dedicated and consumption pricing plans https://docs.microsoft.com/en- us/azure/azure-functions/

  33. Azure Functions

  34. Azure Functions bindings Type Service Trigger Input Output Schedule Azure Functions HTTP Azure Functions Blob Storage Azure Storage Events Azure Event Hubs Queues Azure Storage Queues and topics Azure Service Bus Storage tables Azure Storage SQL tables Azure Mobile Apps No-SQL DB Azure DocumentDB Push Notifications Azure Notification Hubs Twilio SMS Text Twilio SendGrid email SendGrid

  35. Azure functions quickstart Create cross-platform desktop apps using JavaScript and Azure https://www.youtube.com/playlist?list=PLi8ga rtTlTVx7sKg3XLuCQik1XSgUMNgl Sql Saturday 2017 Kyiv https://www.youtube.com/playlist?list=PLi8ga rtTlTVxR9lGYAXUNTk1Mo0qG1j7i

  36. Questions? Anton Boyko Microsoft Azure MVP Ninja Azure Consultant boyko.ant@live.com

More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#