Upload
welld
View
110
Download
0
Embed Size (px)
Citation preview
• Matteo Codogno: I am a software developer at WellD, with a particular focus on Java EE technologies. I love to experiment with new technologies, open source projects and design Software architectures.
• Simone D’Avico: I recently attained a Master of Informatics at USI, Lugano, and joined the software development team at WellD shortly afterwards. I am particularly passionate about functional programming and software architecture.
1ABOUT US
DON’T PANIC !THE BIRTH AND EVOLUTION OF A MICROSERVICES ARCHITECTURE
Lugano Tech Talk Meetup, March 2017
3THE PRODUCT
Source 1
Source N
…
Orders repository
Distributed File
System
Search
API
+ Few features
- Huge, distributed document repository (file system based)
- Complex search criteria involving an algorithm to determine which paths to explore during the search
+ Granular scalability was a key concern
+ We had a container orchestrator available
4IDEA: LEVERAGE MICROSERVICES
7HOW DO WE DESIGN A MICROSERVICES ARCHITECTURE ?
Monolithic
Application
Service 1
Service 2
Service 3
8THE MONOLITH
UsersGroups
Auth
Orders
Products
Search
Files
SOAP API
SettingsUI
Auth
UserManager
SecurityService
OrderService SearchServiceSettingManger
User
Group
Role
Order
OrderType
Product
FileFaq
News
9THE MONOLITH
UsersGroups
Auth
Orders
Products
Search
Files
SOAP API
SettingsUI
Auth
UserManager
SecurityService
OrderService SearchServiceSettingManger
User
Group
Role
Order
OrderType
Product
FileFaq
News
Authentication Orders Search Settings UI
• User authentication
• User authorisation
• CRUD user, group and role
10AUTH MICROSERVICE
Auth
11ORDERS MICROSERVICE
• Load orders from external
sources
• Provide an API to access orders
details
Auth
Orders
12SEARCH MICROSERVICE
• Complex search into file system
to extract order files
• Download files
Auth
Orders
Search
13AUTHENTICATION IN A DISTRIBUTED CONTEXT
How can microservices authenticate external requests?
:( Replicate Auth service logic into every microservice
:) Leverage the auth service to handle the authentication for other microservices
OAuth2 (Token-based)
Auth
Orders
Search
14CURRENT STATE OF THE SYSTEM
OAuth2
Auth
Orders
Search
HOW DO MICROSERVICES TALK TO EACH OTHER?
INTER SERVICE COMMUNICATION
16HOW CAN MICROSERVICES FIND EACH OTHER?
Auth
Orders
Search
IF YOU DON'T KNOW WHERE YOU GO, THEN IT DOESN'T MATTER WHICH PATH YOU TAKE.
Cheshire Cat
17WHERE ARE YOU?
18DISCOVERY MICROSERVICE
Orders
Auth
Search
19EUREKA !!
Orders
Auth
Search
Discovery
20UI MICROSERVICE
Auth Orders Search UI
Discovery
21GATEWAY MICROSERVICE
• Single entry point
• Routing
• Solves CORS
• Reverse proxying
• Downstream authentication
• Request filtering
Auth Orders Search UI
Discovery
Service Gateway
23SCALING MICROSERVICES CONFIGURATION
DEV
24SCALING MICROSERVICES CONFIGURATION
DEV TEST
25SCALING MICROSERVICES CONFIGURATION
DEV
QA
TEST
26SCALING MICROSERVICES CONFIGURATION
DEV
QA
TEST
PROD
27SCALING MICROSERVICES CONFIGURATION
DEV
QA
TEST
PROD
4 ENVIRONMENTS
X
N MICROSERVICES
=
CONFIGURATION MADNESS!
28CONFIG MICROSERVICES
Auth Orders Search UI
Discovery
Config
Gateway
29MICROSERVICES ARCHITECTURE WORKS!
+ Modularity
+ Flexibility
+ Scalability
+ Decoupling
- Additional overhead: services > features!
- Scalability
- Decoupling
30TAKEAWAY MESSAGES
The failure of one service can potentially cascade to other services throughout the application.
31CASCADING FAILURE
Consumer
Consumer
Service A
Service B
Service C
Service D
The failure of one service can potentially cascade to other services throughout the application.
32CASCADING FAILURE
Consumer
Consumer
Service A
Service B
Service C
Service D
The failure of one service can potentially cascade to other services throughout the application.
33CASCADING FAILURE
Consumer
Consumer
Service A
Service B
Service C
Service D
The failure of one service can potentially cascade to other services throughout the application.
34CIRCUIT BREAKING
A B
A B
A B
Timeout, Repeated Failure
Available
Loaded/Unavailable
Circuit Breaking
Request
Response
Request
Fallback
Load balancing improves the distribution of workloads across multiple computing resources.
35LOAD BALANCING
A
A
Bal
ance
r B1B2
BN
B1B2
BN
Dedicated Balancer
Client-Side Balancer
Discovery
microservices.io
…SO LONG, AND THANKS FOR ALL THE FISH !!