SlideShare a Scribd company logo
MICRO
SERVICES
.NET
VITALY BAUM
DVLPR
CNSLTNT
PRDCT MGR
DVLPR
AGENDA
• leaving monolith
• example
• dynamic proxy + communications
• elastic search (elk)
• service discovery
• drawbacks
4
WTF?!
5
What is it?
"Microservices" - yet another
new term on the crowded
streets of software
architecture.
6
What is it?
Single application as a suite of
small services, each running in
its own process and
communicating with
lightweight mechanisms, often
an HTTP resource API
7
8
LEAVING
MONOLITH
9
PROCESS
namespaces
classes
functions
10
MICROSERVICES
process 1
…
process N
11
SIZE
12
CHANGE IT.
OFTEN.
WITH CLOUDS
13
RIGHT SIZE
IS
SHORT-TERM
REWRITING
14
RIGHT SIZE
IS
DEPLOYMENT
UNIT
15
FREEDOM
OF
DEPLOYMENT
AND
SCALE
16
DEPENDECIES
17
CHANGE
SERVICES.
NOT COMPONENTS
18
DO NOT
SHARE
LIBRARIES
19
BOUNDARIES.
MAKE IT RIGHT
20
DO SINGLE THING.
WELL
21
ISOLATION
22
DATABASE
SCHEMA
PER SERVICE
23
COMMUNICATIONS
24
DON’T
TRUST
NETWORK
25
SMART
ENDPOINTS.
DUMP
PIPES
26
Azure
Service Fabric
Akka OTP
MICROSERVICES PLATFORMS
27
BE CHUNKY.
NOT CHATTY.
RPC ISN’T EQUAL
FUNCTION
CALL
28
EXAMPLE
29
FROM MONOLITH
TO MICROSERVICE
IN A MINUTES
30
31
CUSTOMER:
COUNT
MY MONEY
32
PROCESSING REPORT
33
PROCESSING
EVENTS FLOW
REAL-TIME
CRITICAL
34
while (true)
_valuesService
.Receive(Magic.input())
35
REPORT
WEB-BASED
SERVER
RENDRING
36
_reportService.GetForLast5Min()
[“123”, “345”, “678”]
37
IEnumerable<string> GetForLast5Min() {
return _valuesService.Get(
DateTime.Now.AddMinutes(-5);
);
} DEPENDENCY
INJECTION
38
RUN FOR PROFIT!
39
CHANGE
REQUEST:
UPDATE ME
THE VIEW!
40
RUNNING
PROCESS!?
41
SOLUTION
FOUND
42
IEnumerable<string> GetForLast5Min() {
return _valuesService.Get(
DateTime.Now.AddMinutes(-5);
);
} DEPENDENCY
INJECTION
43
DI
CONTAINER
CLIENT 1
CLIENT 2
CLIENT 3
SERVICE 1
SERVICE 2
SERVICE 3
44
IValueService _valuesService =
DynamicProxy.Create<IValueService>();
45
DYNAMIC
PROXY
CLIENT 1
CLIENT 2
CLIENT 3
SERVICE 1
SERVICE 2
SERVICE 3
46
http://www.castleproject.org/projects/
dynamicproxy
https://github.com/mtamme/NProxy
https://github.com/ekonbenefits/
impromptu-interface
DYNAMIC PROXIES
47
ClientInterceptor
void Process(FunctionCall func) {
func.Result = MakeHttpCall(func);
}
GET myservice.local/values?since=5min
48
DYNAMIC
PROXY
CLIENT 1
CLIENT 2
CLIENT 3
SERVICE 1
SERVICE 2
SERVICE 3
49
ServerInterceptor
HttResponse Process(HttpRequest req) {
return CallMyService(req);
}
>> IValueService.Get(time);
50
//share of common interface on both
// sides (client and server) ==
// compiler-time checking
[HttpProperties (Port = 80, SSL = true)]
interface IValueService {
IEnumerable<string> Get();
}
BENEFITS?
51
DYNAMIC
PROXY
OVER THE
INTERFACE
CLIENT 1
CLIENT 2
CLIENT 3
SERVICE 1
SERVICE 2
SERVICE 3
52
message HelloRequest {
string greeting = 1;
}
message HelloResponse {
string reply = 1;
}
service HelloService {
rpc SayHello(HelloRequest) returns
(HelloResponse);
}
53
service Calculator extends
shared.SharedService {
i32 add(1:i32 num1, 2:i32 num2)
}
APACHE THRIFT
54
HOW TO TEST?
55
IEnumerable<string> GetForLast5Min() {
return _valuesService.Get(
DateTime.Now.AddMinutes(-5);
);
} DEPENDENCY
INJECTION
56
MANUAL TESTS
57
REST IS IN PLACE
0. Simple to use (HTTP) and read (JSON)
1. A lot of tools (wget, curl, postman)
58
INTEGRATION TESTS
59
DYNAMIC
PROXY
CLIENT 1
CLIENT 2
CLIENT 3
SERVICE 1
SERVICE 2
SERVICE 3
60
DynamicServiceClientInterceptor
void Process(FunctionCall func) {
func.Result = MakeHttpCall(func);
}
GET myservice.local/values?since=5min
ACTUALLY FAKE
SERVICE
61
DYNAMIC
PROXY
CLIENT 1
CLIENT 2
CLIENT 3
SERVICE 1
62
DYNAMIC
PROXY
CLIENT 1
CLIENT 2
SERVICE 1
TEST LOGIC
63
DynamicServiceClientInterceptor
void Process(FunctionCall func) {
func.Result = _production
? MakeHttpCall(func)
: MakeMockCall(func);
}
LOCAL FAKE
CALL
64
A QUESTION:
WHAT
WAS THE DATA
YESTERDAY?
65
SAVE
LOGS!?
OR DATA?!
66
WEB LOGS
67
YOUR APPS
LOGS
68
REST: HTTP + JSON
69
YOUR APPS
REQUESTS
RESPONSES
70
71
WE
NEED
YOU
SERVE MORE
DATA
72
DATA?
INSTANCES?
73
ClientInterceptor
void Process(FunctionCall func) {
func.Result = MakeHttpCall(func);
}
GET myservice.local/values?since=5min
HARDCODED
74
HIGH AVAILABILITY
75
SERVICE DISCOVERY
76
DISTRIBUTED
KEY VALUE
STORAGE
77
0. Simple to use (REST)
1. Key-Value storage
2. Like a directory tree
3. Sync data to all nodes
4. High available out-of-the-box
WHY ETCD?
78
79
SERVICE REGISTRY
80
string ResolveUrl(string serviceName) {
var url = _readUrlFor(serviceName);
return url;
}
GET http://myetcd/v2/keys/valueService
81
applicationapplication application
KV storageKV storage KV storage
M
82
// wait for update
GET http://myetcd/v2/keys/valueService?
wait=true
LONG POOLING
AND CACHE LOCAL
83
applicationapplication application
KV storageKV storage KV storage
M
84
https://github.com/rogeralsing/Microphone
Consul, ETCD
Nancy, Web Api
MICROPHONE
85
class Program
{
static void Main(string[] args)
{
Cluster.Bootstrap(new WebApiProvider(),
new EtcdProvider(), "values", "v1");
Console.ReadLine();
}
}
public class ValuesController : ApiController
{
public string Get()
{
return "WebApi Service";
}
}
86
CLIENT-SIDE
SERVICE DISCOVERY
87
// automatically load balanced over service
instances
var instance = await
Cluster.FindServiceInstanceAsync("orders");
// use Rest# or similar to call into the remote
service
MakeSomeCall(“/api/orders",
instance.ServiceAddress, instance.ServicePort);
88
with Load Balancer:
- HAProxy
- NGINX
SERVER-SIDE
SERVICE DISCOVERY
89
IMPROVEMENTS?
90
BE
REACTIVE
91
DO NOT CALL.
SEND
MESSAGES
92
SQS Kinesis
Queues Service Bus
DRAWBACKS
94
DO NOT KEEP
IT MICRO.
IT IS NOT ABOUT
LINES OF CODE
95
COMPLEXITY
OVERALL
AS A DISTRIBUTED SYSTEM
96
DON’T
TRUST
NETWORK
97
POLLYPolicy
.Handle<DivideByZeroException>()
.CircuitBreaker(2, TimeSpan.FromMinutes(1))
98
CHANGES
ROLLOUT
IS COMPLEX
99
100
MONITOR
EVERYTHING
101
102
DISTRIBUTED
CONSISTENCY
103
TAKEAWAYS
• Use it if
• Continuos Delivery
• Fast Changes
• Distributed Team
• Be ready for
• Complexity
THANKS!
Q&A
VITALY BAUM
@butaji
vitaly.baum@gmail.com

More Related Content

PDF
MongoDB. local Houston 2019: Distributed Transactions: With Great Power Comes...
PPTX
Apache Incubator Samza: Stream Processing at LinkedIn
PPTX
Kostas Kloudas - Extending Flink's Streaming APIs
PPTX
Kostas Kloudas - Complex Event Processing with Flink: the state of FlinkCEP
PDF
Matthew Treinish, HP - subunit2sql: Tracking 1 Test Result in Millions, OpenS...
PDF
Hello Lambda - How to call Lambdas on AWS
PDF
Kafka’s New Control Plane: The Quorum Controller | Colin McCabe, Confluent
PDF
Lagom - Mircoservices "Just Right"
MongoDB. local Houston 2019: Distributed Transactions: With Great Power Comes...
Apache Incubator Samza: Stream Processing at LinkedIn
Kostas Kloudas - Extending Flink's Streaming APIs
Kostas Kloudas - Complex Event Processing with Flink: the state of FlinkCEP
Matthew Treinish, HP - subunit2sql: Tracking 1 Test Result in Millions, OpenS...
Hello Lambda - How to call Lambdas on AWS
Kafka’s New Control Plane: The Quorum Controller | Colin McCabe, Confluent
Lagom - Mircoservices "Just Right"

What's hot (20)

PDF
Bringing Elliptic Curve Cryptography into the Mainstream
PPTX
Keynote: Stephan Ewen - Stream Processing as a Foundational Paradigm and Apac...
PDF
CFSSL 1.1: The Evolution of a PKI toolkit - DEF CON 23
PDF
Jay Kreps | Kafka Summit 2018 Keynote (Apache Kafka and Event-Oriented Archit...
PDF
How to build megaservices mind7 2021 June 29
PPTX
Stream Processing using Samza SQL
PPTX
Beyond Microservices: Streams, State and Scalability
PDF
Exactly-once Data Processing with Kafka Streams - July 27, 2017
PPT
Pax Migration Ocs 23062008
PDF
Keynote: Scaling Sensu Go
PDF
MongoDB .local Bengaluru 2019: Distributed Transactions: With Great Power Com...
PDF
An analysis of TLS handshake proxying
PPTX
Apache Flink Community Updates November 2016 @ Berlin Meetup
PDF
Kafka for Real-Time Event Processing in Serverless Environments
PDF
Microservices:
 The phantom menace
. Istio Service Mesh: 
the new hope
PPTX
Meetup Microservices Commandments
PPTX
ADDO - Your own Kubernetes controller, not only in Go
PDF
Kafka Connect implementation at GumGum
PDF
Webhooks do's and dont's: what we learned after integrating +100 APIs - Giuli...
PDF
Scaling for India's Cricket Hungry Population (Bhavesh Raheja & Namit Mahuvak...
Bringing Elliptic Curve Cryptography into the Mainstream
Keynote: Stephan Ewen - Stream Processing as a Foundational Paradigm and Apac...
CFSSL 1.1: The Evolution of a PKI toolkit - DEF CON 23
Jay Kreps | Kafka Summit 2018 Keynote (Apache Kafka and Event-Oriented Archit...
How to build megaservices mind7 2021 June 29
Stream Processing using Samza SQL
Beyond Microservices: Streams, State and Scalability
Exactly-once Data Processing with Kafka Streams - July 27, 2017
Pax Migration Ocs 23062008
Keynote: Scaling Sensu Go
MongoDB .local Bengaluru 2019: Distributed Transactions: With Great Power Com...
An analysis of TLS handshake proxying
Apache Flink Community Updates November 2016 @ Berlin Meetup
Kafka for Real-Time Event Processing in Serverless Environments
Microservices:
 The phantom menace
. Istio Service Mesh: 
the new hope
Meetup Microservices Commandments
ADDO - Your own Kubernetes controller, not only in Go
Kafka Connect implementation at GumGum
Webhooks do's and dont's: what we learned after integrating +100 APIs - Giuli...
Scaling for India's Cricket Hungry Population (Bhavesh Raheja & Namit Mahuvak...
Ad

Viewers also liked (20)

PDF
Logo[1]
PPTX
Rebus05
PDF
Oud Geluid 1996
DOC
Job Seeker Tool_Resume Verb List Ecc
PDF
E-Partizipation: Aktuelle Beispiele und Zukunftstrends
PDF
Balika Chetna Kendra, Barahi
PDF
Letra supervitamino
PDF
Storyboad #5
PDF
SMR-99
PPTX
Newsletter- Megan McCreary
DOC
Atatürk resimleri
PPTX
Social Networks Schüler
PDF
Facebook wolfram alpha
DOCX
Lona y gráfica
PDF
Pdf decreto 916 21 oct-2011
PPTX
Como se usa Allshoppings?
PDF
Img
DOC
Formato Presentación de Experiencias Clínicas Jurídicas 2011
PDF
Horario1
Logo[1]
Rebus05
Oud Geluid 1996
Job Seeker Tool_Resume Verb List Ecc
E-Partizipation: Aktuelle Beispiele und Zukunftstrends
Balika Chetna Kendra, Barahi
Letra supervitamino
Storyboad #5
SMR-99
Newsletter- Megan McCreary
Atatürk resimleri
Social Networks Schüler
Facebook wolfram alpha
Lona y gráfica
Pdf decreto 916 21 oct-2011
Como se usa Allshoppings?
Img
Formato Presentación de Experiencias Clínicas Jurídicas 2011
Horario1
Ad

Similar to Microservices on .NET (20)

PDF
L11 Service Design and REST
PDF
20141210 - Microservice Container
PDF
Advanced Microservices - Greach 2015
PPTX
Yotpo microservices
PDF
Microservices on a budget meetup
PPTX
Architecting Microservices in .Net
PDF
Microservices - Hitchhiker's guide to cloud native applications
PPTX
.Net Microservices with Event Sourcing, CQRS, Docker and... Windows Server 20...
PDF
Microservices - opportunities, dilemmas and problems
PPTX
Microservices - modern software architecture
PPTX
Microservice architecture
PDF
Building a Modern Microservices Architecture at Gilt: The Essentials
PPTX
Microservices architecture
PDF
Microservices Architecture
PDF
Term paper 2073131
PDF
#JaxLondon keynote: Developing applications with a microservice architecture
PDF
Developing Applications with a Micro Service Architecture - Chris Richardson
PDF
Andrea Di Persio
PDF
How to Choose the Right Technology, Framework or Tool to Build Microservices
PDF
Microservices Architecture For Conversational Intelligence Platform
L11 Service Design and REST
20141210 - Microservice Container
Advanced Microservices - Greach 2015
Yotpo microservices
Microservices on a budget meetup
Architecting Microservices in .Net
Microservices - Hitchhiker's guide to cloud native applications
.Net Microservices with Event Sourcing, CQRS, Docker and... Windows Server 20...
Microservices - opportunities, dilemmas and problems
Microservices - modern software architecture
Microservice architecture
Building a Modern Microservices Architecture at Gilt: The Essentials
Microservices architecture
Microservices Architecture
Term paper 2073131
#JaxLondon keynote: Developing applications with a microservice architecture
Developing Applications with a Micro Service Architecture - Chris Richardson
Andrea Di Persio
How to Choose the Right Technology, Framework or Tool to Build Microservices
Microservices Architecture For Conversational Intelligence Platform

Recently uploaded (20)

PPTX
MYSQL Presentation for SQL database connectivity
PDF
A comparative analysis of optical character recognition models for extracting...
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Spectroscopy.pptx food analysis technology
PPTX
Machine Learning_overview_presentation.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Big Data Technologies - Introduction.pptx
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
MYSQL Presentation for SQL database connectivity
A comparative analysis of optical character recognition models for extracting...
The AUB Centre for AI in Media Proposal.docx
Review of recent advances in non-invasive hemoglobin estimation
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Spectroscopy.pptx food analysis technology
Machine Learning_overview_presentation.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Building Integrated photovoltaic BIPV_UPV.pdf
sap open course for s4hana steps from ECC to s4
Advanced methodologies resolving dimensionality complications for autism neur...
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Unlocking AI with Model Context Protocol (MCP)
Big Data Technologies - Introduction.pptx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
Digital-Transformation-Roadmap-for-Companies.pptx
Chapter 3 Spatial Domain Image Processing.pdf
20250228 LYD VKU AI Blended-Learning.pptx

Microservices on .NET