Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
Modules or Microservices?
@Sander_Mak
About Sander
Fellow, Software Architect
@ Luminis
Experience in modular
development stacks
Conference Speaker & Author
@Sander_Mak
Modules or Microservices?
@Sander_Mak
Modules or Microservices?
YES
@Sander_Mak
Modules XOR Microservices?
YES
@Sander_Mak
Modules XOR Microservices?
IT DEPENDS
@Sander_Mak
Let's Talk About Modularity
Why Modularity?
Why Modularity?
Why Modularity?
No. 1 Software
Architecture Principle
@Sander_Mak
The Three Tenets of Modularity
Strong
Encapsulation
@Sander_Mak
The Three Tenets of Modularity
Strong
Encapsulation
Well-Defined
Interfaces
@Sander_Mak
The Three Tenets of Modularity
Explicit
Dependencies
Strong
Encapsulation
Well-Defined
Interfaces
@Sander_Mak
Modularity
is the ultimate
Agile Tool
@Sander_Mak
Let's Talk About Microservices
@Sander_Mak
A Microservice is...
Independently deployable
Implementing a business capability
Doing one thing, and doing it well
Communicating over the network
What's This?
What's This?
Microservices
Devroom
What's This?
Microservices
Devroom
Despair
What's This?
Microservices
Devroom
Despair
Praying for a
Better Solution
@Sander_Mak
Yes, Microservices Are Hard
However...
@Sander_Mak
Yes, Microservices Are Hard
However...
Introspection: When (not)
@Sander_Mak
Yes, Microservices Are Hard
However...
Introspection: When (not)
Alternative: Modules
@Sander_Mak
Why?
Manage Complexity
Scaling
Resilience
@Sander_Mak
Why?
Manage Complexity
Scaling
Resilience
Modularity
In Disguise!
@Sander_Mak
users
assignments
learningmaterial
students
grading
courses
attendance
Microservices
@Sander_Mak
users
assignments
learningmaterial
students
grading
courses
attendance
Microservices Monolith?
users
studentslearningmaterial
shipping
courses
forecasting
attendance
@Sander_Mak
users
assignments
learningmaterial
students
grading
courses
attendance
Microservices Monolith?
users
studentslearningmaterial
shipping
courses
forecasting
attendance
@Sander_Mak
Features
Cost
@Sander_Mak
Messy Monolith
Features
Cost
@Sander_Mak
Messy Monolith
Microservices
All The Way
Features
Cost
@Sander_Mak
Messy Monolith
Microservices
All The Way
Features
Cost
@Sander_Mak
Microservices:
Distributed system
Service Discovery
?
?
?
?
users
assignments
learningmaterial
students
grading
courses
attendance
@Sander_Mak
users
assignments
learningmaterial
students
grading
courses
attendance
Microservices:
Distributed system
Network Fallacies
@Sander_Mak
users
assignments
learningmaterial
students
grading
courses
attendance
Microservices:
Distributed system
Deployment
@Sander_Mak
Microservices:
Distributed system
Config. Management
v1
v2
v3
v2
v3
at least x4
(DTAP)
users
assignments
learningmaterial
students
grading
courses
attendance
@Sander_Mak
Microservices: Security
users
assignments
learningmaterial
students
grading
courses
attendance
Distributed system
@Sander_Mak
Messy Monolith
Microservices
All The Way
Features
Cost
@Sander_Mak
Messy Monolith
Microservices
All The Way
Features
Cost
But... vendors?!
@Sander_Mak
Messy Monolith
Microservices
All The Way
Features
Cost
But... vendors?!
Won't magically
transform your
organization!
@Sander_Mak
Let's Talk About Modules
@Sander_Mak
users
assignments
learningmaterial
students
grading
courses
attendance
Microservices
@Sander_Mak
users
assignments
learningmaterial
students
grading
courses
attendance
Microservices Monolith?
users
studentslearningmaterial
shipping
courses
forecasting
attendance
@Sander_Mak
Microservices Modules!
users
assignments
learningmaterial
students
grading
courses
attendance
Modular app users
assignments
learningmaterial
students
grading
courses
attendance
@Sander_Mak
Messy Monolith
Microservices
All The Way
Modular
App
Features
Cost
@Sander_Mak
Messy Monolith
Microservices
All The Way
Modular
App
Features
Cost
@Sander_Mak
So, Modules.
Did You Mean Objects?
@Sander_Mak
So, Modules.
Did You Mean Objects?
Close, but Too Fine-grained.
@Sander_Mak
Module Systems
@Sander_Mak
Module Systems
Java
OSGi
Java 9
@Sander_Mak
Module Systems
Java
OSGi
Java 9
JavaScript
...
ES2015 Modules
@Sander_Mak
Module Systems
Java
OSGi
Java 9
JavaScript
...
ES2015 Modules
C++
C++20?
@Sander_Mak
Module Systems
Java
OSGi
Java 9
JavaScript
...
ES2015 Modules
C++
C++20?
.Net
NuGet
.Net Core
@Sander_Mak
Explicit
Dependencies
Strong
Encapsulation
Well-Defined
Interfaces
Module Systems
Java
OSGi
Java 9
JavaScript
...
ES2015 Modules
C++
C++20?
.Net
NuGet
.Net Core
@Sander_Mak
Module Systems: Java 9
module attendance {
exports attendance.api;
requires students;
requires courses;
}
@Sander_Mak
Module Systems: Java 9
module attendance {
exports attendance.api;
requires students;
requires courses;
}
Strong
Encapsulation
@Sander_Mak
Module Systems: Java 9
module attendance {
exports attendance.api;
requires students;
requires courses;
}
Strong
Encapsulation
Well-Defined
Interfaces
@Sander_Mak
Module Systems: Java 9
module attendance {
exports attendance.api;
requires students;
requires courses;
}
Explicit
Dependencies
Strong
Encapsulation
Well-Defined
Interfaces
@Sander_Mak
Module Systems: Java 9
Module Resolution
(Reliable Configuration)
Increased Security
(Hide Platform Internals)
@Sander_Mak
Module Systems: ES2015
export function sq(i) {
return secret(i);
}
function secret(i) { return i * i; }
@Sander_Mak
Module Systems: ES2015
export function sq(i) {
return secret(i);
}
function secret(i) { return i * i; }
import { sq } from mymodule;
console.log("Two squared", sq(2));
@Sander_Mak
Module Systems: ES2015
export function sq(i) {
return secret(i);
}
function secret(i) { return i * i; }
Strong
Encapsulation
import { sq } from mymodule;
console.log("Two squared", sq(2));
@Sander_Mak
Module Systems: ES2015
export function sq(i) {
return secret(i);
}
function secret(i) { return i * i; }
Strong
Encapsulation
Well-Defined
Interfaces
import { sq } from mymodule;
console.log("Two squared", sq(2));
@Sander_Mak
Module Systems: ES2015
export function sq(i) {
return secret(i);
}
function secret(i) { return i * i; }
Explicit
Dependencies
Strong
Encapsulation
Well-Defined
Interfaces
import { sq } from mymodule;
console.log("Two squared", sq(2));
@Sander_Mak
Module Systems: ES2015
export function sq(i) {
return secret(i);
}
function secret(i) { return i * i; }
import { sq } from mymodule;
console.log("Two squared", sq(2));
Consider
TypeScript
@Sander_Mak
Module Systems: ES2015
export function sq(i) {
return secret(i);
}
function secret(i) { return i * i; }
Well-Defined
Interfaces
import { sq } from mymodule;
console.log("Two squared", sq(2));
Consider
TypeScript
@Sander_Mak
Module Systems: ES2015
export function sq(i) {
return secret(i);
}
function secret(i) { return i * i; }
import { sq } from mymodule;
console.log("Two squared", sq(2)); (let's not go there...)
@Sander_Mak
Module Systems: C++20?
module mymodule;
export int sq(int i) { return secret(i); }
int secret(int i) { return i * i; }
@Sander_Mak
Module Systems: C++20?
module mymodule;
export int sq(int i) { return secret(i); }
int secret(int i) { return i * i; }
#include <stdio.h>
import std.io
import mymodule
int main() {
printf("Two squared %d", sq(2));
return 0;
}
@Sander_Mak
Module Systems: C++20?
module mymodule;
export int sq(int i) { return secret(i); }
int secret(int i) { return i * i; }
#include <stdio.h>
import std.io
import mymodule
int main() {
printf("Two squared %d", sq(2));
return 0;
}
Strong
Encapsulation
@Sander_Mak
Module Systems: C++20?
module mymodule;
export int sq(int i) { return secret(i); }
int secret(int i) { return i * i; }
#include <stdio.h>
import std.io
import mymodule
int main() {
printf("Two squared %d", sq(2));
return 0;
}
Strong
Encapsulation
Well-Defined
Interfaces
@Sander_Mak
Module Systems: C++20?
module mymodule;
export int sq(int i) { return secret(i); }
int secret(int i) { return i * i; }
#include <stdio.h>
import std.io
import mymodule
int main() {
printf("Two squared %d", sq(2));
return 0;
}
Explicit
Dependencies
Strong
Encapsulation
Well-Defined
Interfaces
@Sander_Mak
So, Modules Everywhere!
@Sander_Mak
So, Modules Everywhere!
> Objects
< Applications
@Sander_Mak
users
app.users.User
app.users.UserInfo
app.users.internal.UserImpl
app.users.internal.Util;
assignments
...
...
courses
...
...
students
...
...
attendance
...
...
grading
...
...
learningmaterial
...
...
Not Just on the
Whiteboard
@Sander_Mak
users
app.users.User
app.users.UserInfo
app.users.internal.UserImpl
app.users.internal.Util;
assignments
...
...
courses
...
...
students
...
...
attendance
...
...
grading
...
...
learningmaterial
...
...
Not Just With
Discipline
@Sander_Mak
Modules or Microservices?
IT DEPENDS
@Sander_Mak
Manage Complexity
Scaling
Resilience
@Sander_Mak
Manage Complexity
Scaling
Resilience
@Sander_Mak
Manage Complexity
Scaling
Resilience
?
?
@Sander_Mak
Advantages of Modules
Ease of
Deployment &
Management
@Sander_Mak
Advantages of Modules
Ease of
Deployment &
Management
Modular Application
@Sander_Mak
Advantages of Modules
Strong but
Refactorable
Boundaries
@Sander_Mak
Advantages of Modules
Strong but
Refactorable
Boundaries
https://www.infoq.com/presentations/microservices-future
~1800 microservices
@Sander_Mak
Advantages of Modules
Strong but
Refactorable
Boundaries
"The [Linux] project is structured so
people can work independently,
Torvalds explained. "We've been
able to really modularize the code
and development model so we
can do a lot in parallel." - El Reg
@Sander_Mak
Advantages of Modules
Strongly typed,
In-Process
Communication
@Sander_Mak
Advantages of Modules
Strongly typed,
In-Process
Communication
No Serialization or Network Latency
@Sander_Mak
Advantages of Modules
Strongly typed,
In-Process
Communication
Ever Tried Serializing a Function?
@Sander_Mak
Advantages of Modules
Strongly typed,
In-Process
Communication
GraphQL or Protobuf > REST
@Sander_Mak
Advantages of Modules
Strongly typed,
In-Process
Communication
@Sander_Mak
Advantages of Modules
Strongly typed,
In-Process
*Synchronous*
Communication
@Sander_Mak
Advantages of Modules
Eventual
Consistency
is a Choice
@Sander_Mak
Advantages of Modules
Eventual
Consistency
is a Choice
It's Still a Good Idea to Partition Data
@Sander_Mak
Advantages of Microservices
Best Stack for Each Service
@Sander_Mak
Advantages of Microservices
Best Stack for Each Service
learningmaterial students assignments
(but is your org ready for this?)
@Sander_Mak
Advantages of Microservices
Independent Deployment
learningmaterial students assignmentsv2 v3 v1
@Sander_Mak
Advantages of Microservices
Independent Deployment
learningmaterial students assignmentsv2 v3 v1
(beware of deployment dependencies!)
@Sander_Mak
Advantages of Microservices
Independent Deployment
learningmaterial students assignmentsv2 v3 v1
Modularized App > Distributed Monolith
(beware of deployment dependencies!)
@Sander_Mak
Advantages of Microservices
Independent Failure
learningmaterial students assignments
@Sander_Mak
Advantages of Microservices
Independent Failure
learningmaterial students assignments
(when your services are truly autonomous...)
@Sander_Mak
Advantages of Microservices
Independent Scaling
assignments
learningmaterial
4x g2.2xlarge 2x t2.medium 1x t2.micro
students
@Sander_Mak
Advantages of Microservices
vs. Uniform Scaling
Modular Application
3x t2.large
@Sander_Mak
It's Time to Wrap Up
@Sander_Mak
@Sander_Mak
At the speed of light,
everything changes!
@Sander_Mak
At the speed of light,
everything changes!
Dude, chill. The apple still
doesn't fall far from the tree.
@Sander_Mak
Don't Solve Problems
You Don't Have
At the speed of light,
everything changes!
Dude, chill. The apple still
doesn't fall far from the tree.
@Sander_Mak
You Are (most likely) Not at
Uber or Netflix Scale
scale
organizations
@Sander_Mak
You Are (most likely) Not at
Uber or Netflix Scale
scale
organizations
@Sander_Mak
You Are (most likely) Not at
Uber or Netflix Scale
scale
organizations
the 80% of us
@Sander_Mak
Solve Problems You Do Have
In The Simplest Possible Way
@Sander_Mak
Solve Problems You Do Have
In The Simplest Possible Way
At Least Read Up on Modular Development
In Your Tech Stack of Choice
Explicit
Dependencies
Strong
Encapsulation
Well-Defined
Interfaces
@Sander_Mak
Design as Microservices,
Build as Modules
You Can Move to (Micro)services Later.
@Sander_Mak
Design as Microservices,
Build as Modules
You Can Move to (Micro)services Later.
Modules Enable

Larger Services!
@Sander_Mak
Design as Microservices,
Build as Modules
Don't worry, you can still do:
Reactive NoSQL Cloud DevOps DDD
@Sander_Mak
Messy Monolith
Microservices
All The Way
Modular
App
Features
Cost
Thanks. Read More:
bit.ly/modularapps
bit.ly/java9book
@Sander_Mak

More Related Content

Modules or microservices?