KEMBAR78
Microservices Tutorial Session at JavaOne 2016 | PDF
Microservices
A Tutorial Session
JavaOne 2016
by Jason Swartz
@swartzrock
MICROSERVICES
WHAT WHY
a.k.a “WHEN”
HOW
What’s A
Microservice?
Your Application,
Subdivided
Recipe: Microservices
(makes 5-10 microservices)
Ingredients:
● A Monolithic API, Too Big To Handle
Instructions:
1. Find the seams in your application - by operation, business area, or team.
2. Split your API into multiple smaller API’s, each on its own server.
3. Figure out how to deploy them w/o breaking everything.
4. Figure out how they’ll talk to each other w/o breaking more things.
5. Figure out how complex data operations will work across multiple data stores.
Let’s Split-Up
That Service
1. Small & Maintainable
2. Private data
3. Generally Isolated
Microservice Properties
1. Small & Maintainable
2. Private data
3. Generally Isolated
Microservice Nice-To-Haves
1. Findable
2. Scalable
3. Resilient
4. Monitorable
Microservice Nice-To-Haves
Microservices That Speak To Each Other Via
Asynchronous Communication
Microservice Real Nice-To-Haves
Let’s See a
Real
Transaction
Web Client: PUT issues/123 Assignee=10
Issues Service: Read from issues db
Issues Service: GET users/10
Issues Service: POST users/notify/10
Issues Service: Write to issues db
Issues Service: Return response with result
Web Client: Read response & status then handle it
Web Client: PUT issues/123 Assignee=10
Issues Service: Read from issues db
// block for synchronous transaction
// block for synchronous transaction
Issues Service: Write to issues db
Issues Service: Return response with result
Web Client: Read response & status then handle it
Blocking Isn’t
Isolated, Scalable
Or Resilient
But It Is
Easy!
1. Easy!
2. Gratifying.
3. Testable.
Synchronous Messaging Pros
1. Prevents microservices from being isolated,
scalable, and resilient.
2. Hope you like waiting.
Synchronous Messaging Cons
Microservices
Should Talk
Asynchronously
1. Non-Blocking IO (eg RxJava, Netty)
2. Queues (eg SQS)
3. Event Streams (eg Kafka, Kinesis)
4. Actors (eg Akka)
Talking Asynchronously
What About The
Clients?
1. Synchronous REST with Async Clients
2. Http 202
3. Websockets
4. Http/2
Responding Asynchronously
That’s What
Microservices Are All
About
WHAT WHY
a.k.a “WHEN”
HOW
Monolith
To
Microservices
Why
Might This Be A
Good Idea?
(Assuming You’re Planning
to Split Up your Monolith)
1. Finding code and refactoring it is pretty easy.
2. No network lag
3. No format conversion errors
4. Deploy in one go
Monoliths - Not So Bad
That’s All
Thanks For Listening!
1. Hard to scale up just one feature
2. Hard to deploy just one change
3. Not suitable for more than a small team
Monoliths - Not So Scalable Either
Organizations Are
Constrained To Produce
Designs That Match Their
Communication Structure
Max Capacity:
One Team
Max Capacity:
Two Teams
Don’t Split Monoliths
Across Your
Communication
Structures
(we kind of covered this already)
Microservices Pros
1. Network Lag
2. Multiple Data Formats
3. Service Resolution
4. Troubleshooting
5. More Deployment Work
6. More Monitoring
Microservices Challenges
No Problem.
Let’s Get Started On
How
You’ll Build Em
WHAT WHY
a.k.a “WHEN”
HOW
Microservices In
Java
How Will You Get
Your App In
Production?
1. Self-Running Jar’s
2. VM Images
3. Docker Images
Deployment Formats
1. Use A CI To Build / Test / Merge in CI
2. Use A CD To Deploy (Push-Button / Auto)
3. VM Deployment (eg Spinnaker)
4. Docker Deployment (eg ECS, K8s, Marathon)
5. Cluster Management (eg K8s, Mesos, Swarm)
Deployment Strategies
Yes
Should I Deploy To The Cloud?
YES OH YES
Should I Test It First?
1. Service Resolution (K8s, Consul)
2. Scaling
3. Visibility
4. Authentication
5. Monitoring
Microservice Management
Let’s Talk
Microservices
Development
(why switch now?)
Choosing A Framework
1. Spring Boot
2. Lagom
3. Ratpack
4. Dropwizard
Choosing A Framework
1. Good Ol’ SQL (eg MySQL, Postgresql)
2. Document-type NoSQL
3. Fast Key-Value Caches
Choosing A Data Store
1. CRUD operations endpoints & tables
2. CRUD endpoints and immutable tables
3. Event-Sourced Data
Choosing A Data Scheme
Create-Read-
Update-Delete
Let’s Talk About
Immutable Tables
GET /issues
GET /issues/{id}
POST /issues
PUT /issues/{id}
Issue Endpoints
How Do These Events
Affect The Database?
1. POST /issues title=’Config ELB’
+------+-------------+------------+----------+-------+
| id | updated | title | assignee | done |
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:13 | Config ELB | NULL | false |
+------+-------------+------------+----------+-------+
1. POST /issues title=’Config ELB’
2. PUT /issues/1 assignee=10
+------+-------------+------------+----------+-------+
| id | updated | title | assignee | done |
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:16 | Config ELB | 10 | false |
+------+-------------+------------+----------+-------+
1. POST /issues title=’Config ELB’
2. PUT /issues/1 assignee=10
3. PUT /issues/1 done=true
+------+-------------+------------+----------+-------+
| id | updated | title | assignee | done |
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:24 | Config ELB | NULL | true |
+------+-------------+------------+----------+-------+
1. POST /issues title=’Config ELB’
2. PUT /issues/1 assignee=10
3. PUT /issues/1 done=true
+------+-------------+------------+----------+-------+
| id | updated | title | assignee | done |
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:24 | Config ELB | NULL | true |
+------+-------------+------------+----------+-------+
Not Bad.
1. POST /issues title=’Config ELB’
2. PUT /issues/1 assignee=10
3. PUT /issues/1 done=true
+------+-------------+------------+----------+-------+
| id | updated | title | assignee | done |
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:24 | Config ELB | NULL | true |
+------+-------------+------------+----------+-------+
Do You Know How We Got Here?
+------+-------------+------------+----------+-------+
| id | updated | title | assignee | done |
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:24 | Config ELB | NULL | true |
+------+-------------+------------+----------+-------+
Do You Know How We Got Here?
1. POST /issues title=’Config ELB’
2. PUT /issues/1 assignee=10
3. PUT /issues/1 done=true
+------+-------------+------------+----------+-------+
| id | updated | title | assignee | done |
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:24 | Config ELB | NULL | true |
+------+-------------+------------+----------+-------+
Do You Know How We Got Here?
1. POST /issues title=’Config ELB’
2. PUT /issues/1 assignee=10
3. PUT /issues/1 done=true
+------+-------------+------------+----------+-------+
| id | updated | title | assignee | done |
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:24 | Config ELB | NULL | true |
+------+-------------+------------+----------+-------+
Why is ‘assignee’ NULL?
Mutable Table Rows
Lose History
Immutable Table
Rows KeepTheir History
Let’s Try To
Lock Down
Our State
1. POST /issues title=’Config ELB’
+------+-------------+------------+----------+-------+
| id | updated | title | assignee | done |
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:13 | Config ELB | NULL | false |
+------+-------------+------------+----------+-------+
1. POST /issues title=’Config ELB’
2. PUT /issues/1 assignee=10
+------+-------------+------------+----------+-------+
| id | updated | title | assignee | done |
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:13 | Config ELB | NULL | false |
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:16 | Config ELB | 10 | false |
+------+-------------+------------+----------+-------+
1. POST /issues title=’Config ELB’
2. PUT /issues/1 assignee=10
3. PUT /issues/1 done=true
+------+-------------+------------+----------+-------+
| id | updated | title | assignee | done |
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:13 | Config ELB | NULL | false |
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:16 | Config ELB | 10 | false |
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:19 | Config ELB | NULL | false |
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:24 | Config ELB | NULL | true |
+------+-------------+------------+----------+-------+
1. POST /issues title=’Config ELB’
2. PUT /issues/1 assignee=10
3. PUT /issues/1 done=true
+------+-------------+------------+----------+-------+
| id | updated | title | assignee | done |
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:13 | Config ELB | NULL | false |
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:16 | Config ELB | 10 | false |
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:19 | Config ELB | NULL | false |
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:24 | Config ELB | NULL | true |
+------+-------------+------------+----------+-------+
1. GET /issues/1
+------+-------------+------------+----------+-------+
| id | updated | title | assignee | done |
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:13 | Config ELB | NULL | false |
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:16 | Config ELB | 10 | false |
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:19 | Config ELB | NULL | false |
+------+-------------+------------+----------+-------+
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:24 | Config ELB | NULL | true |
+------+-------------+------------+----------+-------+
How Do You Make An
Append-Only
Table?
One: Don’t Let Your DB
User Make
Changes
Grant select, insert on
issues to my-db-user;
Two: Pick The Right
Columns
create table issues (
id serial,
created timestamp default now(),
creator_id int,
issue_id int default nextval(‘iseq’),
title text,
assignee int,
done boolean default false
)
Do We Still Need
State?
Let’s Talk About
Event-Sourcing
1. POST /issues title=’Config ELB’
2. PUT /issues/1 assignee=10
3. PUT /issues/1 done=true
+------+-------------+------------+----------+-------+
| id | updated | title | assignee | done |
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:13 | Config ELB | NULL | false |
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:16 | Config ELB | 10 | false |
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:24 | Config ELB | 10 | true |
+------+-------------+------------+----------+-------+
1. POST /issues title=’Config ELB’
2. PUT /issues/1 assignee=10
3. PUT /issues/1 done=true
+------+-------------+------------+----------+-------+
| id | updated | title | assignee | done |
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:13 | Config ELB | NULL | false |
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:16 | Config ELB | 10 | false |
+------+-------------+------------+----------+-------+
| 1 | 09-18 18:24 | Config ELB | 10 | true |
+------+-------------+------------+----------+-------+
Events
States
Now We’re Storing
Events,
Not States
create table issue_events (
id serial,
created timestamp default now(),
issue_id int default nextval(‘iseq’),
originator text,
payload text
)
1. POST /issue/1/event ‘Originator: 4a48239-8a..’
payload=’<Update val=”done=true”>’
+----+-------------+----------+------------+---------+
| id | created | issue_id | originator | payload |
+----+-------------+----------+------------+---------+
| 14 | 09-18 18:50 | 1 | 4a482... | <...> |
+----+-------------+----------+------------+---------+
Create Events And
Simulate The State
1. Create-Issue
Issue(“Config ELB”, null, false);
Real Events
Virtual States
1. Create-Issue
2. Assign-Issue
Issue(“Config ELB”, 10, false);
Real Events
Virtual States
1. Create-Issue
2. Assign-Issue
3. Complete-Issue
Issue(“Config ELB”, 10, true);
Real Events
Virtual States
So Why Use
Event-Sourcing?
1. High Write Performance
2. Potential for Command/Query Separation
3. Auditable
4. Replayable
5. Undo-able
6. Monitorable
Reasons For Event-Sourcing
It’s Like Having Control
Over The Versions Of
Your State Changes
It’s Like Having Control
Over The Versions Of
Your Data
It’s Like Git
For Your Data
1. Frankly, It’s Weird
2. Requires Events. No Events, No Event-Sourcing.
3. As Of Sept 2016, It’s Still Non-Standard
Reasons Against Event-Sourcing
That About Sums Up
Microservice
Development
That About Sums Up
Microservice
Development
Okay, Actually That’s The
Entire Session
Unless There’s More Time
WHAT WHY
a.k.a “WHEN”
HOW
by Jason Swartz
@swartzrock
Microservices
A Tutorial Session
JavaOne 2016
Web Applications for the REST of Us: An Introduction to
Ember.js, Akka, and Spray (Craig Tataryn & Sean Kowaski)
A Practical RxJava Example with Ratpack (Laurent Doguin)
One Microservice Is No Microservice: They Come In Systems
(Markus Eisele)
Make Sure To See...
Thank You
For Attending
Fin
Just Kidding, There’s
Another Section
Let’s Talk
Asynchronous
Architectures in AWS
Do You Want To Use
Caches To Prevent
Unnecessary
Blocking Calls?
Do You Want To Insert
Rows And Publish
Events In One Stroke?
Do You Want To
Mass-Publish One Event
To All Microservices?
Note About Your Solution:
I’m Not Saying It’s AWS
But It’s AWS
Okay, We Are Really
Done This Time
THIS SPACE
LEFT BLANK

Microservices Tutorial Session at JavaOne 2016

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
    Recipe: Microservices (makes 5-10microservices) Ingredients: ● A Monolithic API, Too Big To Handle Instructions: 1. Find the seams in your application - by operation, business area, or team. 2. Split your API into multiple smaller API’s, each on its own server. 3. Figure out how to deploy them w/o breaking everything. 4. Figure out how they’ll talk to each other w/o breaking more things. 5. Figure out how complex data operations will work across multiple data stores.
  • 11.
  • 15.
    1. Small &Maintainable 2. Private data 3. Generally Isolated Microservice Properties
  • 16.
    1. Small &Maintainable 2. Private data 3. Generally Isolated Microservice Nice-To-Haves
  • 17.
    1. Findable 2. Scalable 3.Resilient 4. Monitorable Microservice Nice-To-Haves
  • 18.
    Microservices That SpeakTo Each Other Via Asynchronous Communication Microservice Real Nice-To-Haves
  • 20.
  • 21.
    Web Client: PUTissues/123 Assignee=10 Issues Service: Read from issues db Issues Service: GET users/10 Issues Service: POST users/notify/10 Issues Service: Write to issues db Issues Service: Return response with result Web Client: Read response & status then handle it
  • 22.
    Web Client: PUTissues/123 Assignee=10 Issues Service: Read from issues db // block for synchronous transaction // block for synchronous transaction Issues Service: Write to issues db Issues Service: Return response with result Web Client: Read response & status then handle it
  • 23.
  • 24.
  • 25.
    1. Easy! 2. Gratifying. 3.Testable. Synchronous Messaging Pros
  • 26.
    1. Prevents microservicesfrom being isolated, scalable, and resilient. 2. Hope you like waiting. Synchronous Messaging Cons
  • 27.
  • 28.
    1. Non-Blocking IO(eg RxJava, Netty) 2. Queues (eg SQS) 3. Event Streams (eg Kafka, Kinesis) 4. Actors (eg Akka) Talking Asynchronously
  • 29.
  • 30.
    1. Synchronous RESTwith Async Clients 2. Http 202 3. Websockets 4. Http/2 Responding Asynchronously
  • 31.
  • 32.
  • 33.
  • 34.
    Why Might This BeA Good Idea?
  • 35.
    (Assuming You’re Planning toSplit Up your Monolith)
  • 36.
    1. Finding codeand refactoring it is pretty easy. 2. No network lag 3. No format conversion errors 4. Deploy in one go Monoliths - Not So Bad
  • 37.
  • 38.
    1. Hard toscale up just one feature 2. Hard to deploy just one change 3. Not suitable for more than a small team Monoliths - Not So Scalable Either
  • 39.
    Organizations Are Constrained ToProduce Designs That Match Their Communication Structure
  • 41.
  • 43.
  • 44.
    Don’t Split Monoliths AcrossYour Communication Structures
  • 45.
    (we kind ofcovered this already) Microservices Pros
  • 46.
    1. Network Lag 2.Multiple Data Formats 3. Service Resolution 4. Troubleshooting 5. More Deployment Work 6. More Monitoring Microservices Challenges
  • 47.
    No Problem. Let’s GetStarted On How You’ll Build Em
  • 48.
  • 49.
  • 50.
    How Will YouGet Your App In Production?
  • 51.
    1. Self-Running Jar’s 2.VM Images 3. Docker Images Deployment Formats
  • 52.
    1. Use ACI To Build / Test / Merge in CI 2. Use A CD To Deploy (Push-Button / Auto) 3. VM Deployment (eg Spinnaker) 4. Docker Deployment (eg ECS, K8s, Marathon) 5. Cluster Management (eg K8s, Mesos, Swarm) Deployment Strategies
  • 53.
    Yes Should I DeployTo The Cloud?
  • 54.
    YES OH YES ShouldI Test It First?
  • 55.
    1. Service Resolution(K8s, Consul) 2. Scaling 3. Visibility 4. Authentication 5. Monitoring Microservice Management
  • 56.
  • 57.
  • 58.
    1. Spring Boot 2.Lagom 3. Ratpack 4. Dropwizard Choosing A Framework
  • 59.
    1. Good Ol’SQL (eg MySQL, Postgresql) 2. Document-type NoSQL 3. Fast Key-Value Caches Choosing A Data Store
  • 60.
    1. CRUD operationsendpoints & tables 2. CRUD endpoints and immutable tables 3. Event-Sourced Data Choosing A Data Scheme
  • 61.
  • 62.
  • 64.
    GET /issues GET /issues/{id} POST/issues PUT /issues/{id} Issue Endpoints
  • 65.
    How Do TheseEvents Affect The Database?
  • 66.
    1. POST /issuestitle=’Config ELB’ +------+-------------+------------+----------+-------+ | id | updated | title | assignee | done | +------+-------------+------------+----------+-------+ | 1 | 09-18 18:13 | Config ELB | NULL | false | +------+-------------+------------+----------+-------+
  • 67.
    1. POST /issuestitle=’Config ELB’ 2. PUT /issues/1 assignee=10 +------+-------------+------------+----------+-------+ | id | updated | title | assignee | done | +------+-------------+------------+----------+-------+ | 1 | 09-18 18:16 | Config ELB | 10 | false | +------+-------------+------------+----------+-------+
  • 68.
    1. POST /issuestitle=’Config ELB’ 2. PUT /issues/1 assignee=10 3. PUT /issues/1 done=true +------+-------------+------------+----------+-------+ | id | updated | title | assignee | done | +------+-------------+------------+----------+-------+ | 1 | 09-18 18:24 | Config ELB | NULL | true | +------+-------------+------------+----------+-------+
  • 69.
    1. POST /issuestitle=’Config ELB’ 2. PUT /issues/1 assignee=10 3. PUT /issues/1 done=true +------+-------------+------------+----------+-------+ | id | updated | title | assignee | done | +------+-------------+------------+----------+-------+ | 1 | 09-18 18:24 | Config ELB | NULL | true | +------+-------------+------------+----------+-------+ Not Bad.
  • 70.
    1. POST /issuestitle=’Config ELB’ 2. PUT /issues/1 assignee=10 3. PUT /issues/1 done=true +------+-------------+------------+----------+-------+ | id | updated | title | assignee | done | +------+-------------+------------+----------+-------+ | 1 | 09-18 18:24 | Config ELB | NULL | true | +------+-------------+------------+----------+-------+ Do You Know How We Got Here?
  • 71.
    +------+-------------+------------+----------+-------+ | id |updated | title | assignee | done | +------+-------------+------------+----------+-------+ | 1 | 09-18 18:24 | Config ELB | NULL | true | +------+-------------+------------+----------+-------+ Do You Know How We Got Here?
  • 72.
    1. POST /issuestitle=’Config ELB’ 2. PUT /issues/1 assignee=10 3. PUT /issues/1 done=true +------+-------------+------------+----------+-------+ | id | updated | title | assignee | done | +------+-------------+------------+----------+-------+ | 1 | 09-18 18:24 | Config ELB | NULL | true | +------+-------------+------------+----------+-------+ Do You Know How We Got Here?
  • 73.
    1. POST /issuestitle=’Config ELB’ 2. PUT /issues/1 assignee=10 3. PUT /issues/1 done=true +------+-------------+------------+----------+-------+ | id | updated | title | assignee | done | +------+-------------+------------+----------+-------+ | 1 | 09-18 18:24 | Config ELB | NULL | true | +------+-------------+------------+----------+-------+ Why is ‘assignee’ NULL?
  • 74.
  • 75.
  • 76.
    Let’s Try To LockDown Our State
  • 77.
    1. POST /issuestitle=’Config ELB’ +------+-------------+------------+----------+-------+ | id | updated | title | assignee | done | +------+-------------+------------+----------+-------+ | 1 | 09-18 18:13 | Config ELB | NULL | false | +------+-------------+------------+----------+-------+
  • 78.
    1. POST /issuestitle=’Config ELB’ 2. PUT /issues/1 assignee=10 +------+-------------+------------+----------+-------+ | id | updated | title | assignee | done | +------+-------------+------------+----------+-------+ | 1 | 09-18 18:13 | Config ELB | NULL | false | +------+-------------+------------+----------+-------+ | 1 | 09-18 18:16 | Config ELB | 10 | false | +------+-------------+------------+----------+-------+
  • 79.
    1. POST /issuestitle=’Config ELB’ 2. PUT /issues/1 assignee=10 3. PUT /issues/1 done=true +------+-------------+------------+----------+-------+ | id | updated | title | assignee | done | +------+-------------+------------+----------+-------+ | 1 | 09-18 18:13 | Config ELB | NULL | false | +------+-------------+------------+----------+-------+ | 1 | 09-18 18:16 | Config ELB | 10 | false | +------+-------------+------------+----------+-------+ | 1 | 09-18 18:19 | Config ELB | NULL | false | +------+-------------+------------+----------+-------+ | 1 | 09-18 18:24 | Config ELB | NULL | true | +------+-------------+------------+----------+-------+
  • 80.
    1. POST /issuestitle=’Config ELB’ 2. PUT /issues/1 assignee=10 3. PUT /issues/1 done=true +------+-------------+------------+----------+-------+ | id | updated | title | assignee | done | +------+-------------+------------+----------+-------+ | 1 | 09-18 18:13 | Config ELB | NULL | false | +------+-------------+------------+----------+-------+ | 1 | 09-18 18:16 | Config ELB | 10 | false | +------+-------------+------------+----------+-------+ | 1 | 09-18 18:19 | Config ELB | NULL | false | +------+-------------+------------+----------+-------+ | 1 | 09-18 18:24 | Config ELB | NULL | true | +------+-------------+------------+----------+-------+
  • 81.
    1. GET /issues/1 +------+-------------+------------+----------+-------+ |id | updated | title | assignee | done | +------+-------------+------------+----------+-------+ | 1 | 09-18 18:13 | Config ELB | NULL | false | +------+-------------+------------+----------+-------+ | 1 | 09-18 18:16 | Config ELB | 10 | false | +------+-------------+------------+----------+-------+ | 1 | 09-18 18:19 | Config ELB | NULL | false | +------+-------------+------------+----------+-------+ +------+-------------+------------+----------+-------+ | 1 | 09-18 18:24 | Config ELB | NULL | true | +------+-------------+------------+----------+-------+
  • 82.
    How Do YouMake An Append-Only Table?
  • 83.
    One: Don’t LetYour DB User Make Changes
  • 84.
    Grant select, inserton issues to my-db-user;
  • 85.
    Two: Pick TheRight Columns
  • 86.
    create table issues( id serial, created timestamp default now(), creator_id int, issue_id int default nextval(‘iseq’), title text, assignee int, done boolean default false )
  • 87.
    Do We StillNeed State?
  • 88.
  • 89.
    1. POST /issuestitle=’Config ELB’ 2. PUT /issues/1 assignee=10 3. PUT /issues/1 done=true +------+-------------+------------+----------+-------+ | id | updated | title | assignee | done | +------+-------------+------------+----------+-------+ | 1 | 09-18 18:13 | Config ELB | NULL | false | +------+-------------+------------+----------+-------+ | 1 | 09-18 18:16 | Config ELB | 10 | false | +------+-------------+------------+----------+-------+ | 1 | 09-18 18:24 | Config ELB | 10 | true | +------+-------------+------------+----------+-------+
  • 90.
    1. POST /issuestitle=’Config ELB’ 2. PUT /issues/1 assignee=10 3. PUT /issues/1 done=true +------+-------------+------------+----------+-------+ | id | updated | title | assignee | done | +------+-------------+------------+----------+-------+ | 1 | 09-18 18:13 | Config ELB | NULL | false | +------+-------------+------------+----------+-------+ | 1 | 09-18 18:16 | Config ELB | 10 | false | +------+-------------+------------+----------+-------+ | 1 | 09-18 18:24 | Config ELB | 10 | true | +------+-------------+------------+----------+-------+ Events States
  • 95.
  • 96.
    create table issue_events( id serial, created timestamp default now(), issue_id int default nextval(‘iseq’), originator text, payload text )
  • 97.
    1. POST /issue/1/event‘Originator: 4a48239-8a..’ payload=’<Update val=”done=true”>’ +----+-------------+----------+------------+---------+ | id | created | issue_id | originator | payload | +----+-------------+----------+------------+---------+ | 14 | 09-18 18:50 | 1 | 4a482... | <...> | +----+-------------+----------+------------+---------+
  • 98.
  • 99.
    1. Create-Issue Issue(“Config ELB”,null, false); Real Events Virtual States
  • 100.
    1. Create-Issue 2. Assign-Issue Issue(“ConfigELB”, 10, false); Real Events Virtual States
  • 101.
    1. Create-Issue 2. Assign-Issue 3.Complete-Issue Issue(“Config ELB”, 10, true); Real Events Virtual States
  • 102.
  • 103.
    1. High WritePerformance 2. Potential for Command/Query Separation 3. Auditable 4. Replayable 5. Undo-able 6. Monitorable Reasons For Event-Sourcing
  • 104.
    It’s Like HavingControl Over The Versions Of Your State Changes
  • 105.
    It’s Like HavingControl Over The Versions Of Your Data
  • 106.
  • 107.
    1. Frankly, It’sWeird 2. Requires Events. No Events, No Event-Sourcing. 3. As Of Sept 2016, It’s Still Non-Standard Reasons Against Event-Sourcing
  • 108.
    That About SumsUp Microservice Development
  • 109.
    That About SumsUp Microservice Development
  • 110.
    Okay, Actually That’sThe Entire Session Unless There’s More Time
  • 111.
  • 112.
  • 113.
  • 114.
    Web Applications forthe REST of Us: An Introduction to Ember.js, Akka, and Spray (Craig Tataryn & Sean Kowaski) A Practical RxJava Example with Ratpack (Laurent Doguin) One Microservice Is No Microservice: They Come In Systems (Markus Eisele) Make Sure To See...
  • 115.
  • 116.
  • 117.
  • 118.
  • 119.
    Do You WantTo Use Caches To Prevent Unnecessary Blocking Calls?
  • 121.
    Do You WantTo Insert Rows And Publish Events In One Stroke?
  • 124.
    Do You WantTo Mass-Publish One Event To All Microservices?
  • 127.
    Note About YourSolution: I’m Not Saying It’s AWS
  • 128.
  • 129.
    Okay, We AreReally Done This Time
  • 130.