1. 9 y 10 de febrero
#T3chFest2017
9 y 10 de febrero
#T3chFest2017
9 y 10 de febrero
#T3chFest2017
Microservcios, en qué lío me he metido.
Ernesto Hernández
Packlink
Miguel Ortega
Packlink
2. 9 y 10 de febrero
#T3chFest2017
9 y 10 de febrero
#T3chFest2017
4. 9 y 10 de febrero
#T3chFest2017
Labels
Tracking
Payments: Credit card, Paypal, Deferred
Invoicing
E-commerces integration
Autocomplete rules
Zip codes
NOT JUST A SIMPLE
CARRIER COMPARATOR
5. 9 y 10 de febrero
#T3chFest2017
● 7 Countries
● Over 50 carriers
● >300 shipping services
● >500% shipment grow
● >2M shipments/year
6. 9 y 10 de febrero
#T3chFest2017
http://transformcustomers.com/category/business-transformation/
9 y 10 de febrero
#T3chFest2017
7. 9 y 10 de febrero
#T3chFest2017
Our legacy old
Monolith
http://isijisan.blogspot.com.es/2015/03/el-escarabajo-pelotero.html
9. 9 y 10 de febrero
#T3chFest2017
Our shiny
and new
Monolith
https://mekubal.wordpress.com/2012/04/03/the-myth-of-monolithic-judaism/
KOKUDO
10. 9 y 10 de febrero
#T3chFest2017
Our Monoliths
KOKUDO
11. 9 y 10 de febrero
#T3chFest2017
Business needs!!! We need an API
12. 9 y 10 de febrero
#T3chFest2017Sometimes you need to clean up
13. 9 y 10 de febrero
#T3chFest2017
● Another monolith
● ESB orchestration
● DB coupling
● Fixed deploy dates
● Something distributed
● More choreography
● Different storages
● Deploy flexibility
14. 9 y 10 de febrero
#T3chFest2017
It seems clear right?
Microservices
15. 9 y 10 de febrero
#T3chFest2017
2014 2015 2016
16. 9 y 10 de febrero
#T3chFest2017
but what the hell is a microservice?
CHALLENGE
ACCEPTED
24. 9 y 10 de febrero
#T3chFest2017
Phase 4
9 y 10 de febrero
#T3chFest2017
25. 9 y 10 de febrero
#T3chFest2017
Synchronous calls
Network call
26. 9 y 10 de febrero
#T3chFest2017
Synchronous calls
Network call
27. 9 y 10 de febrero
#T3chFest2017
Phase 4
9 y 10 de febrero
#T3chFest2017
28. 9 y 10 de febrero
#T3chFest2017
● SYNCHRONOUS CALLS HELL
● WHERE ARE MY JOINS?
warning
29. 9 y 10 de febrero
#T3chFest2017
Asynchronous
MESSAGE BUS
30. 9 y 10 de febrero
#T3chFest2017
Phase 5
9 y 10 de febrero
#T3chFest2017
31. 9 y 10 de febrero
#T3chFest2017
Event Driven Architecture Apps generates events when
an action occurs.
Events are published to a
message bus
Events represent things that
happened in our apps like
“client.created”
Other apps can react to this
events with other actions or
creating materialized views
32. 9 y 10 de febrero
#T3chFest2017
New apps can only receive
events since the time that
was introduced in our
platform
Materialized view for the new
microservice it’s not complete
What about a new microservice ?
33. 9 y 10 de febrero
#T3chFest2017
Event store
Apps events are stored in
an event log
34. 9 y 10 de febrero
#T3chFest2017
Event store
Apps events are stored in
an event log
Events are appended at
the end of the log
35. 9 y 10 de febrero
#T3chFest2017
If a new service is added
to the platform, it`s
materialized view can be
recreated with the past
events
Event store - adding a new app
Apps events are stored in
an event log
Events are appended at
the end of the log
36. 9 y 10 de febrero
#T3chFest2017
Benefits
• Materialized views
• Rebuild app state
• Stream processing
• CEP
37. 9 y 10 de febrero
#T3chFest2017
“Distributed transactions”
• Avoid 2 phase commit !!!
• Do compensating
transactions instead
38. 9 y 10 de febrero
#T3chFest2017
Event Sourcing
https://martinfowler.com/articles/201701-event-driven.html
http://microservices.io/patterns/data/event-driven-architecture.html
40. 9 y 10 de febrero
#T3chFest2017
Docker Ecosystem FTW
● build once, run everywhere
● easy scaling with docker-compose
● infrastructure scaling with swarm
41. 9 y 10 de febrero
#T3chFest2017
Hashicorp Consul
- Key/Value (backed by git repo)
- consul-template
- Leader election
- DNS
- Already needed for docker swarm
9 y 10 de febrero
#T3chFest2017
42. 9 y 10 de febrero
#T3chFest2017
Service discovery
9 y 10 de febrero
#T3chFest2017
43. 9 y 10 de febrero
#T3chFest2017
How do I develop locally?
9 y 10 de febrero
#T3chFest2017
44. 9 y 10 de febrero
#T3chFest2017
New old problems
● Onboarding new developers
● Config management
● Debugging
● Data Bootstrapping
45. 9 y 10 de febrero
#T3chFest2017
What do we need?
● Infrastructure Bootstrapping:
○ up and running
○ configuration
● Microservices Bootstrapping:
○ up and running
○ application data
46. 9 y 10 de febrero
#T3chFest2017
How do we solved it?
● Infrastructure Bootstrapping.
○ up and running
○ configuration
● Microservices Bootstrapping:
○ up and running
○ application data
9 y 10 de febrero
#T3chFest2017
47. 9 y 10 de febrero
#T3chFest2017
How do we solved it?
● Infrastructure Bootstrapping.
○ up and running
○ configuration
● Microservices Bootstrapping:
○ up and running
○ application data
9 y 10 de febrero
#T3chFest2017
48. 9 y 10 de febrero
#T3chFest2017
Platform versioning
• microservices.yml - v 2.1.4
• search-engine v 2.3.1
• client v 4.2.3
• infrastructure.yml - v 2.1.4
• percona v 5.6
• rabbitmq v 3.5
• config repo - v 2.1.4
Packlink v 2.1.4
49. 9 y 10 de febrero
#T3chFest2017
Local development
50. 9 y 10 de febrero
#T3chFest2017
Service discovery (review)
9 y 10 de febrero
#T3chFest2017
51. 9 y 10 de febrero
#T3chFest2017
Local development with your IDE
9 y 10 de febrero
#T3chFest2017
52. 9 y 10 de febrero
#T3chFest2017
Tunnel
9 y 10 de febrero
#T3chFest2017
53. 9 y 10 de febrero
#T3chFest2017
Service discovery (all together)
9 y 10 de febrero
#T3chFest2017
54. 9 y 10 de febrero
#T3chFest2017
● DUDE, WHERE ARE MY LOGS?
DEBUG
56. 9 y 10 de febrero
#T3chFest2017
Correlation id
Network call
{ correlation_id: 123, ... }
{ correlation_id: 123, ... }{ correlation_id: 123, ... }
{ correlation_id: 123, ... }
{ correlation_id: 123, ... }
{ correlation_id: 123, ... }
57. 9 y 10 de febrero
#T3chFest2017
● Make your application
log-aggregator agnostic
FATAL
58. 9 y 10 de febrero
#T3chFest2017
● How do I trace a single request?
TRACE
59. 9 y 10 de febrero
#T3chFest2017
Distributed tracing
60. 9 y 10 de febrero
#T3chFest2017
Our (helpful) Dev Tools
61. 9 y 10 de febrero
#T3chFest2017
https://slack.com
62. 9 y 10 de febrero
#T3chFest2017
Wiggumbot
https://wiki.jenkins-ci.org/display/JENKINS/GitHub+pull+request+builder+plugin
http://docs.sonarqube.org/display/PLUG/GitHub+Plugin9 y 10 de febrero
#T3chFest2017
(Our personal code-reviewer guardian)
63. 9 y 10 de febrero
#T3chFest2017
Hound
https://github.com/etsy/hound
Etsy, Inc.
9 y 10 de febrero
#T3chFest2017
64. 9 y 10 de febrero
#T3chFest2017
Asciidoctor
http://asciidoctor.org
9 y 10 de febrero
#T3chFest2017
65. 9 y 10 de febrero
#T3chFest2017
Was it worth it?
9 y 10 de febrero
#T3chFest2017