SlideShare a Scribd company logo
Building Micro-Services with Scala 
Lior Shapsa, Yardena Meymann 
September 22, 2014 
© 2014 VMware Inc. All rights reserved.
Traditional Architecture
Traditional Architecture
Problems with Monoliths 
• Size 
• Integration (Conway’s law) 
• Modules Change at Different Rates 
• Dependencies Collisions 
• Scalability requirements of modules 
FEAR OF CHANGE 
FEAR OF INNOVATION
Micro Services
Thought Leaders 
Netflix, Amazon, 
LinkedIn, Google, 
ThoughtWorks, Gilt, 
… 
Fred George 
Martin Fowler 
Kit Colbert 
Ben Fathi 
Stefan Tilkov 
VMware
What are micro-services? 
A set of narrowly focused,
What are micro-services? 
A set of narrowly focused, 
independently deployable services,
What are micro-services? 
A set of narrowly focused, 
independently deployable services, 
talking via uniform interfaces
What are micro-services? 
A set of narrowly focused, 
independently deployable services, 
talking via uniform interfaces
Micro-services 
• Each running in its own process 
• Communicating with lightweight 
mechanisms, often an HTTP 
resource API 
• Built around business capabilities 
• Independently deployable 
– fully automated deployment 
• May be in a different programming language and use 
different data storage technologies.
Micro-services 
DEPLOYING A CHANGE IS LOW RISK
#NonBlocking
Threaded vs. Evented Servers 
• Monolithic 
– Most modules communicate in-process 
• Micro-services 
– communicate remotely, often over the network 
– need to support cheap, lightweight remote communication 
• Threaded servers use thread per connection 
• Evented servers use non-blocking IO and callbacks 
– Netty 
– Node.js 
– Play 
– Spray
services vs. seconds 
http://www.eecs.berkeley.edu/~rcs/research/interactive_latency.html 
https://www.youtube.com/watch?v=1-vcErOPofQ
Threaded servers 
Service A Service B Service N
Threaded servers 
Service A Service B Service N 
Thread Thread Thread
Threaded servers 
Service A Service B Service N 
Thread Thread Thread 
Thread Thread Thread
Threaded servers 
Service A Service B Service N 
Thread Thread Thread 
Thread Thread Thread 
Thread Thread Thread
Thread 
Service A Service B Service N 
Thread 
Thread 
Threaded servers 
Thread 
Thread 
Thread 
Thread 
Thread 
Thread 
Thread 
Thread 
Thread 
Thread 
Thread 
Thread 
Thread Thread Thread
Thread 
Service A Service B Service N 
Thread 
Thread 
Threaded servers 
Thread 
Thread 
Thread 
Thread 
Thread 
Thread 
Thread 
Thread 
Thread 
Thread 
Thread 
Thread 
Thread Thread Thread
#NonBlocking – Evented servers 
Service A Service B Service N 
Thread Thread Thread 
callback callback
#NonBlocking – Play/Spray 
• Based on Akka using Netty 
– Non-blocking programming much easier 
• Easy deployment 
– Embedded Server 
• Rich JSON and HTTP support 
• Plugins 
– Secure Social 
– Caching 
– …. 
• SCALA!
#NonBlocking – Play example 
…
#AKKA
Backend 
Pre-process Analyze
Spray 
Node 
Dispatch 
Crawling 
library 
Netty 
Price Engine 
Head 
Actor 
… 
Pages 
Level1 Level1 
Level2 
… 
Level2 
File 
writer 
Head 
Actor 
… 
k/v 
Node 
Akka Cluster 
curl http://AkkaCluster/site_dot_com?op=start
#AKKA 
• Based on the Actor Model 
– http://www.reversim.com/2014/04/summit-2014-scale-up-your-thinking.html 
• Resilience 
• Location Transparency 
– Cluster sharding 
– Cluster clients 
• Load Balancing 
• Message Queue Integration
#Containers
What is ? 
• Dockers are like lightweight VM for a single process 
– Self contained 
– No hypervisor 
– Shared kernel, but Isolated and content agnostic 
– No lib conflict 
– No OS boot time 
– Distributing a change is easy, using δ 
• A Clean, Safe, Isolated and Portable Micro Service
Docker File 
• Docker Image is Built From a DockerFile 
• Consists of Descriptive Set of Instructions 
– Start from a base image 
– Run and command 
– Add a file or directory 
– Create an environment variable 
– What process to run on launch
SBT 
• Assemble “Dockerized” micro services 
• We started with sbt-native-packager 
– Poor Docker functionality 
• We ended up with sbt-docker plugin 
– https://github.com/marcuslonnberg/sbt-docker 
– Still Using sbt-native-packager to package 
– Ends up with Docker file
Price Engine Service
#Containers - DockerFile
#Containers – Using SBT
#Containers – Using SBT 
• Using Sequences to optimize 
– Reduce build time 
– Smaller Containers
#Containers – Orchestration 
• CoreOS 
– Linux for massive server deployments 
– Cluster management with Fleet 
– Service discovery with etcd 
• Evaluating 
– Kubernetes 
– Flynn 
– Consul 
– Ambassadord
#AKKA 
Summary 
#NonBloc 
king 
#Containers
Building Micro-Services with Scala
Building Micro-Services with Scala
Building Micro-Services with Scala
Lior Shapsa 
lshapsa@gmail.com 
Twitter: @liorshapsa 
Yardena Meymann 
ymeymann@gmail.com 
Twitter: @ymeymann

More Related Content

PPTX
Container orchestration overview
PDF
Velocity NYC 2016 - Containers @ Netflix
PPTX
Netflix0SS Services on Docker
PPTX
NetflixOSS for Triangle Devops Oct 2013
PDF
The new Netflix API
PPTX
Container Orchestration with Docker Swarm and Kubernetes
PDF
Dev309 from asgard to zuul - netflix oss-final
PPTX
Re:invent 2016 Container Scheduling, Execution and AWS Integration
Container orchestration overview
Velocity NYC 2016 - Containers @ Netflix
Netflix0SS Services on Docker
NetflixOSS for Triangle Devops Oct 2013
The new Netflix API
Container Orchestration with Docker Swarm and Kubernetes
Dev309 from asgard to zuul - netflix oss-final
Re:invent 2016 Container Scheduling, Execution and AWS Integration

What's hot (19)

PPT
Sebastien goasguen cloud stack the next year
PPT
Sebastien goasguen cloud stack and docker
PPT
Docker in the Cloud
PDF
Observability beyond logging for Java Microservices
PPTX
Sas 2015 event_driven
PPTX
Openstack Overview
PPTX
MicroServices at Netflix - challenges of scale
PDF
Rohit yadav cloud stack internals
PPTX
Docker for Ops: Docker Networking Deep Dive, Considerations and Troubleshooti...
PDF
Introduction to Akka-Streams
PPTX
Serverless
PDF
Netflix Open Source Meetup Season 4 Episode 3
PDF
Kubernetes for Serverless - Serverless Summit 2017 - Krishna Kumar
PDF
"[WORKSHOP] K8S for developers", Denis Romanuk
PPTX
The Mushroom Cloud Effect or What Happens When Containers Fail? by Alois Mayr...
PPT
DevOpsCon Cloud Workshop
PDF
Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures
PDF
Innovating faster with SBT, Continuous Delivery, and LXC
PPTX
Bitbucket Pipelines - Powered by Kubernetes
Sebastien goasguen cloud stack the next year
Sebastien goasguen cloud stack and docker
Docker in the Cloud
Observability beyond logging for Java Microservices
Sas 2015 event_driven
Openstack Overview
MicroServices at Netflix - challenges of scale
Rohit yadav cloud stack internals
Docker for Ops: Docker Networking Deep Dive, Considerations and Troubleshooti...
Introduction to Akka-Streams
Serverless
Netflix Open Source Meetup Season 4 Episode 3
Kubernetes for Serverless - Serverless Summit 2017 - Krishna Kumar
"[WORKSHOP] K8S for developers", Denis Romanuk
The Mushroom Cloud Effect or What Happens When Containers Fail? by Alois Mayr...
DevOpsCon Cloud Workshop
Develop and Deploy Cloud-Native Apps as Resilient Microservice Architectures
Innovating faster with SBT, Continuous Delivery, and LXC
Bitbucket Pipelines - Powered by Kubernetes
Ad

Viewers also liked (20)

PDF
Microservices in Scala: Play Framework
PDF
Microservices in Scala - theory & practice
PDF
Building microservices with Scala, functional domain models and Spring Boot
PDF
Sharepoint, Liferay & Co.: Social Business Integration in der Praxis
PDF
Five things I learned about information security
PDF
Real World Scalaz
PDF
building blocks of a scalable webcrawler
PDF
Zalando Tech: From Java to Scala in Less Than Three Months
PDF
Vert.X: Microservices Were Never So Easy (Clement Escoffier)
PDF
Microservices and functional programming
PDF
Building and deploying microservices with event sourcing, CQRS and Docker (Ha...
PPT
Web Crawling and Data Gathering with Apache Nutch
PDF
How to hack into the big data team
PDF
Automated Security Hardening with OpenStack-Ansible
PDF
Shift: Real World Migration from MongoDB to Cassandra
PPT
Spark streaming with kafka
PDF
Code Your Agility - Tips for Boosting Technical Agility in Your Organization
PDF
Securing Microservices using Play and Akka HTTP
PDF
Resilient Applications with Akka Persistence - Scaladays 2014
PDF
Spring Boot Microservices vs Akka Actor Cluster
Microservices in Scala: Play Framework
Microservices in Scala - theory & practice
Building microservices with Scala, functional domain models and Spring Boot
Sharepoint, Liferay & Co.: Social Business Integration in der Praxis
Five things I learned about information security
Real World Scalaz
building blocks of a scalable webcrawler
Zalando Tech: From Java to Scala in Less Than Three Months
Vert.X: Microservices Were Never So Easy (Clement Escoffier)
Microservices and functional programming
Building and deploying microservices with event sourcing, CQRS and Docker (Ha...
Web Crawling and Data Gathering with Apache Nutch
How to hack into the big data team
Automated Security Hardening with OpenStack-Ansible
Shift: Real World Migration from MongoDB to Cassandra
Spark streaming with kafka
Code Your Agility - Tips for Boosting Technical Agility in Your Organization
Securing Microservices using Play and Akka HTTP
Resilient Applications with Akka Persistence - Scaladays 2014
Spring Boot Microservices vs Akka Actor Cluster
Ad

Similar to Building Micro-Services with Scala (20)

PDF
Rami Sayar - Node microservices with Docker
PDF
Integration in the Age of DevOps
PDF
Cloud Native Camel Riding
PDF
Fuse integration-services
PPTX
Node.js meetup at Palo Alto Networks Tel Aviv
PPTX
ma-formation-en-Docker-jlklk,nknkjn.pptx
PPTX
Micro services
PDF
The Future of SDN in CloudStack by Chiradeep Vittal
PDF
Microservices Runtimes
PDF
Chicago Microservices Integration Talk
PDF
Container Networking Deep Dive
PDF
We don't need consensus: All agreed?
PPTX
Performance of Microservice Frameworks on different JVMs
PPTX
Docker - Portable Deployment
PDF
Directions for CloudStack Networking
PDF
Monolithic to Microservices Architecture
PPTX
Microservices
PPTX
UNITde II - Docker-Containerization.pptx,
PPTX
Microservices Platforms - Which is Best?
PPTX
JavaEE Microservices platforms
Rami Sayar - Node microservices with Docker
Integration in the Age of DevOps
Cloud Native Camel Riding
Fuse integration-services
Node.js meetup at Palo Alto Networks Tel Aviv
ma-formation-en-Docker-jlklk,nknkjn.pptx
Micro services
The Future of SDN in CloudStack by Chiradeep Vittal
Microservices Runtimes
Chicago Microservices Integration Talk
Container Networking Deep Dive
We don't need consensus: All agreed?
Performance of Microservice Frameworks on different JVMs
Docker - Portable Deployment
Directions for CloudStack Networking
Monolithic to Microservices Architecture
Microservices
UNITde II - Docker-Containerization.pptx,
Microservices Platforms - Which is Best?
JavaEE Microservices platforms

More from Yardena Meymann (7)

PDF
Writing Asynchronous Programs with Scala & Akka
PPTX
Scale up your thinking
PDF
Jenkins Reviewbot
PPTX
Concurrency in Scala - the Akka way
PPTX
All about scala
PPT
Scala introduction
PDF
Scala at HUJI PL Seminar 2008
Writing Asynchronous Programs with Scala & Akka
Scale up your thinking
Jenkins Reviewbot
Concurrency in Scala - the Akka way
All about scala
Scala introduction
Scala at HUJI PL Seminar 2008

Recently uploaded (20)

PDF
Approach and Philosophy of On baking technology
PDF
Advanced IT Governance
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Electronic commerce courselecture one. Pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
[발표본] 너의 과제는 클라우드에 있어_KTDS_김동현_20250524.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Empathic Computing: Creating Shared Understanding
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Spectral efficient network and resource selection model in 5G networks
Approach and Philosophy of On baking technology
Advanced IT Governance
“AI and Expert System Decision Support & Business Intelligence Systems”
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Electronic commerce courselecture one. Pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Diabetes mellitus diagnosis method based random forest with bat algorithm
MYSQL Presentation for SQL database connectivity
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
[발표본] 너의 과제는 클라우드에 있어_KTDS_김동현_20250524.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Dropbox Q2 2025 Financial Results & Investor Presentation
NewMind AI Weekly Chronicles - August'25 Week I
Empathic Computing: Creating Shared Understanding
Network Security Unit 5.pdf for BCA BBA.
Spectral efficient network and resource selection model in 5G networks

Building Micro-Services with Scala

  • 1. Building Micro-Services with Scala Lior Shapsa, Yardena Meymann September 22, 2014 © 2014 VMware Inc. All rights reserved.
  • 4. Problems with Monoliths • Size • Integration (Conway’s law) • Modules Change at Different Rates • Dependencies Collisions • Scalability requirements of modules FEAR OF CHANGE FEAR OF INNOVATION
  • 6. Thought Leaders Netflix, Amazon, LinkedIn, Google, ThoughtWorks, Gilt, … Fred George Martin Fowler Kit Colbert Ben Fathi Stefan Tilkov VMware
  • 7. What are micro-services? A set of narrowly focused,
  • 8. What are micro-services? A set of narrowly focused, independently deployable services,
  • 9. What are micro-services? A set of narrowly focused, independently deployable services, talking via uniform interfaces
  • 10. What are micro-services? A set of narrowly focused, independently deployable services, talking via uniform interfaces
  • 11. Micro-services • Each running in its own process • Communicating with lightweight mechanisms, often an HTTP resource API • Built around business capabilities • Independently deployable – fully automated deployment • May be in a different programming language and use different data storage technologies.
  • 12. Micro-services DEPLOYING A CHANGE IS LOW RISK
  • 14. Threaded vs. Evented Servers • Monolithic – Most modules communicate in-process • Micro-services – communicate remotely, often over the network – need to support cheap, lightweight remote communication • Threaded servers use thread per connection • Evented servers use non-blocking IO and callbacks – Netty – Node.js – Play – Spray
  • 15. services vs. seconds http://www.eecs.berkeley.edu/~rcs/research/interactive_latency.html https://www.youtube.com/watch?v=1-vcErOPofQ
  • 16. Threaded servers Service A Service B Service N
  • 17. Threaded servers Service A Service B Service N Thread Thread Thread
  • 18. Threaded servers Service A Service B Service N Thread Thread Thread Thread Thread Thread
  • 19. Threaded servers Service A Service B Service N Thread Thread Thread Thread Thread Thread Thread Thread Thread
  • 20. Thread Service A Service B Service N Thread Thread Threaded servers Thread Thread Thread Thread Thread Thread Thread Thread Thread Thread Thread Thread Thread Thread Thread
  • 21. Thread Service A Service B Service N Thread Thread Threaded servers Thread Thread Thread Thread Thread Thread Thread Thread Thread Thread Thread Thread Thread Thread Thread
  • 22. #NonBlocking – Evented servers Service A Service B Service N Thread Thread Thread callback callback
  • 23. #NonBlocking – Play/Spray • Based on Akka using Netty – Non-blocking programming much easier • Easy deployment – Embedded Server • Rich JSON and HTTP support • Plugins – Secure Social – Caching – …. • SCALA!
  • 24. #NonBlocking – Play example …
  • 25. #AKKA
  • 27. Spray Node Dispatch Crawling library Netty Price Engine Head Actor … Pages Level1 Level1 Level2 … Level2 File writer Head Actor … k/v Node Akka Cluster curl http://AkkaCluster/site_dot_com?op=start
  • 28. #AKKA • Based on the Actor Model – http://www.reversim.com/2014/04/summit-2014-scale-up-your-thinking.html • Resilience • Location Transparency – Cluster sharding – Cluster clients • Load Balancing • Message Queue Integration
  • 30. What is ? • Dockers are like lightweight VM for a single process – Self contained – No hypervisor – Shared kernel, but Isolated and content agnostic – No lib conflict – No OS boot time – Distributing a change is easy, using δ • A Clean, Safe, Isolated and Portable Micro Service
  • 31. Docker File • Docker Image is Built From a DockerFile • Consists of Descriptive Set of Instructions – Start from a base image – Run and command – Add a file or directory – Create an environment variable – What process to run on launch
  • 32. SBT • Assemble “Dockerized” micro services • We started with sbt-native-packager – Poor Docker functionality • We ended up with sbt-docker plugin – https://github.com/marcuslonnberg/sbt-docker – Still Using sbt-native-packager to package – Ends up with Docker file
  • 36. #Containers – Using SBT • Using Sequences to optimize – Reduce build time – Smaller Containers
  • 37. #Containers – Orchestration • CoreOS – Linux for massive server deployments – Cluster management with Fleet – Service discovery with etcd • Evaluating – Kubernetes – Flynn – Consul – Ambassadord
  • 38. #AKKA Summary #NonBloc king #Containers
  • 42. Lior Shapsa lshapsa@gmail.com Twitter: @liorshapsa Yardena Meymann ymeymann@gmail.com Twitter: @ymeymann

Editor's Notes

  • #29: Messaging – Kafka Resilience - Handles Failures with Supervision
  • #38: We write unit files that tells the CoreOS fleet scheduler how to deploy our Docker containers. We will use the etcd key-value store to communicate between our application containers.
  • #40: Logs Monitoring
  • #41: Logs Monitoring
  • #42: Logs Monitoring