@yshayy
Notmyproblem!Notmyproblem!DelegatingrespobisiblitestoDelegatingrespobisiblitesto
infrastrucutreinfrastrucutre
Yshay Yaacobi
@yshayy
https://git.io/fxh57
@yshayy
As a developer, I want to focus on
building features that deliver
business value
@yshayy
InfrastructureInfrastructure
@yshayy
Monolith ---------→ Microservices
@yshayy
FewMonolithsFewMonoliths
Monolith #1
Monolith #2 Monolith #3
@yshayy
FewMonolithsFewMonoliths
Application code
Infra code
Application code
Infra code
Application code
Infra code
@yshayy
Monoliths ----→ Lots of Microservices
@yshayy
Monoliths ----→ Lots of Microservices
@yshayy
ServicestructureServicestructure
----→
Infra-code and business logic code live together with
every Microservice
@yshayy
ServicestructureServicestructure
----→
How can we write only our business code and let our
hosting environment take care of the rest?
@yshayy
Yshay Yaacobi
@yshayy
AboutmeAboutme
Tech lead @ Soluto
Open source
Cloud architecture
Functional Programming
Docker
Code Quality
@yshayy
AboutSolutoAboutSoluto
Based in Tel Aviv, acquired by Asurion at 2013
Next generation of tech support
150M users worldwide
We love open-source
@yshayy
@yshayy
ShiftingtomicroservicesShiftingtomicroservices
~5 services -> 100+ services
Cultural change, new aspects of ownership
CI/CD - Better tooling automation
Self-service
@yshayy
HowdoesaserviceHowdoesaservice
looklike?looklike?
@yshayy
DEMO‑NotificationsserviceV1DEMO‑NotificationsserviceV1
@yshayy
Spec‑NotificationsserviceSpec‑Notificationsservice
We want to send notifications to users
Notifications will be based in templates
Notifications will be personalized
@yshayy
Flow‑NotificationserviceFlow‑Notificationservice
1. Get user identifier and notification type
2. Fetch user details from users micro-service
3. Format message using a template
4. Send a message
@yshayy
Let'swritesomecodeLet'swritesomecode
@yshayy
DemoDemo
@yshayy
What'smissing?What'smissing?
- Visibility
- Security
- Resiliency
@yshayy
LoggingLogging
We need to add a logger
We send logs to a 3rd party provider
Let's get a library + a provider
@yshayy
☑ Logging
☐ Error policies
☐ Authentication
☐ Monitoring
@yshayy
ErrorpoliciesErrorpolicies
The network can fail
We want to retry failed requests
Let's add Polly
@yshayy
☑ Logging
☑ Error policies
☐ Authentication
☐ Monitoring
@yshayy
AuthenticationAuthentication
We'll use JWT token
OIDC/OAuth2
@yshayy
☑ Logging
☑ Error policies
☑ Authentication
☐ Monitoring
@yshayy
MonitoringMonitoring
Performance metrics, throughput, latency
Statsd client
@yshayy
☑ Logging
☑ Error policies
☑ Authentication
☑ Monitoring
@yshayy
DemoDemo
@yshayy
Whatjusthappenedhere?Whatjusthappenedhere?
We wanted a small micro service and got a
bunch of code and dependencies
@yshayy
Whatjusthappendhere?Whatjusthappendhere?
4 X Lines of codes !!!
3 X Direct dependencies !!!
@yshayy
Soluto‑microservicesv1Soluto‑microservicesv1
Shared template - dependencies and code blocks
Used by teams as a boilerplate
Shared “common” packages/frameworks
Lots of DI magic
Worked well until...
@yshayy
ProblemsProblems
Upgrades are Hard
Dependencies can break
Dependencies can conflict
Dependencies requires re-build+re-deploy
Extremely difficult to introduce global change
@yshayy
Andthat'snottheworse...Andthat'snottheworse...
@yshayy
WeneedtosolveitforeachandeveryWeneedtosolveitforeachandevery
programminglanguageprogramminglanguage
NotalllanguagesarebornequalNotalllanguagesarebornequal
@yshayy
@yshayy
As a developer, I want to focus on
building features that deliver
business value
@yshayy
Which of these concerns can be solved at environment
level ?
@yshayy
Soluto‑microservicesv2Soluto‑microservicesv2
+
@yshayy
KubernetesKubernetes
Orchestrate our services
Solves many cross cutting concerns
@yshayy
AASidecarSidecarContainerContainer
Additonal Container in a pod
Provide functionality
to support main app
Co-scheduled together in
replicas
@yshayy
SidecarscanhelpussolveSidecarscanhelpussolve
infrastructureconcernsinfrastructureconcernsexternallyexternallytoto
ourappourapp
@yshayy
Let'sgetridofstuffLet'sgetridofstuff
@yshayy
LoggingRevisitedLoggingRevisited
@yshayy
LoggingLogging
Treat Logs as event streams
Use log forwarder
Scrape the logs from Docker
@yshayy
FluentDFluentD
Run on every node (Daemonset)
Declarative configuration to define log pipelines
@yshayy
Logging‑extrabenefitsLogging‑extrabenefits
Different policies
Info/Debug -> low retention
Error/Fatal -> high retention
Plugins -> anonymization
@yshayy
☑ Logging
☑ Error policies
☑ Authentication
☑ Monitoring
@yshayy
ErrorpoliciesRevisitedErrorpoliciesRevisited
@yshayy
ErrorpoliciesErrorpolicies
Service-mesh, THE buzzword for 2018
Istio
Injects proxy sidecar
@yshayy
Servicemesh‑IstioServicemesh‑Istio
@yshayy
Servicemesh‑ResiliencyServicemesh‑Resiliency
Configurable failure handling
@yshayy
ServicemeshextrabenefitsServicemeshextrabenefits
Security
Traffic management
Tracing
Too many to count...
@yshayy
☑ Logging
☑ Error recovery
☑ Authentication
☑ Monitoring
@yshayy
AuthenticationRevisitedAuthenticationRevisited
@yshayy
AuthenticationAuthentication
Let's use a sidecar
Soluto/Airbag
@yshayy
Authentication‑AirbagAuthentication‑Airbag
@yshayy
Authentication‑AirbagAuthentication‑Airbag
Configuration yaml example
Open source
Probably be superseded by
Istio's origin authentication
@yshayy
☑ Logging
☑ Resiliency
☑ Authentication
☑ Monitoring
@yshayy
MonitoringRevisitedMonitoringRevisited
@yshayy
MonitoringMonitoring
@yshayy
☑ Logging
☑ Resiliency
☑ Authentication
☑ Monitoring
@yshayy
DEMODEMO
@yshayy
AnewrequirementAnewrequirement
It's black friday!
We want to send lots of messages
@yshayy
AnewrequirementAnewrequirement
It's a batch process
Let's use a queue
@yshayy
Howdeweprocessqueueitems?Howdeweprocessqueueitems?
PrevioussolutionsPrevioussolutions
@yshayy
YetAnothersidecarYetAnothersidecar
@yshayy
@yshayy
DequeueDaemonSidecarDequeueDaemonSidecar
Soluto/DQD
Read items from queue, activate service
Back-pressure support
Expose consumption metrics
@yshayy
DQD‑DemoDQD‑Demo
@yshayy
DQD‑benefitsDQD‑benefits
Scaled with service
Testing
Agnostic
@yshayy
SeconditerationSeconditeration
Lots of code elimination
Dependencies removal
Leaner, more testable service
Declarative approach
Better visibility
@yshayy
ArchitectureArchitecture
External processes
Agents & Proxies
Co-scheduling
NotalllanguagesarebornequalNotalllanguagesarebornequal
@yshayy
X
@yshayy
HowdiditHowdiditaffectaffectus?us?
Cleaner, leaner services
Testing got easier
Faster adoptions of new languages and tools
No more Soluto.Logging/Monitoring/Auth/...
packages
Rapid adoption of k8s by teams
We're still learning...
@yshayy
Howfarcanwego?Howfarcanwego?
Gateways - routing, caching, validation, rate
limiting, policies
Configuration - secrets, cloud resource binding
Tools - remote debugging/profiling Supporting
services - analytics, feature flags, etc…
Platform - FAAS/Serverless/Workflows
Probably more… ( )https://landscape.cncf.io/
@yshayy
As a developer, I want to focus on
building features that deliver
business value
@yshayy
WhatcantheWhatcanthe
infrastructuredoforinfrastructuredofor
you?you?
@yshayy
Thankyou.Thankyou.
@yshayy
Questions?Questions?
(Yes, we're hiring )
@yshayy
Additionalresources‑toolsAdditionalresources‑tools
AirBag - github.com/soluto/airbag
DQD - github.com/soluto/dqd
FluentD -
Prometheus -
Istio -
Skaffold -
github.com/GoogleContainerTools/skaffold
Oidc-server-mock - github.com/Soluto/oidc-server-
mock
FluentD k8s level filter - github.com/Soluto/fluent-
plugin-kubernetes-log-level
https://www.fluentd.org/
https://prometheus.io
https://istio.io/
@yshayy
AdditonalresourcesAdditonalresources
CNCF landscape -
Design patterns for container-based distributed systems -
Introduction to modern network load balancing and proxying -
https://landscape.cncf.io/
https://static.googleusercontent.com/media/research.google.com/e
https://blog.envoyproxy.io/introduction-to-modern-network-load-b
a57f6ff80236

Not my problem! Delegating responsibilities to the infrastructure - Yshay Yaacobi, Soluto - Cloud Native Day Tel Aviv 2018