Advertisement
Advertisement

More Related Content

Advertisement

Similar to Microservices in Scala - theory & practice(20)

Advertisement

Microservices in Scala - theory & practice

  1. ITERATORSI T E R A T O R S @luksow Microservices in Scala theory & practice Łukasz Sowa, Warsaw Scala Enthusiasts 2015-07-08
  2. ITERATORSI T E R A T O R S @luksow Hi, I'm Łukasz ● Co-founder, engineer @ Iterators (https://iterato.rs) ● ScalaWAW organizer (http://meetup.com/ScalaWAW) ● Specializes in: highly concurrent & distributed systems ● Pizza, beer & football lover ● http://luksow.com (soon!) ● contact@luksow.com ● @luksow
  3. ITERATORSI T E R A T O R S @luksow What's in it for you? ● Learn – What are microservices? – How to implement them using Scala ● Takeaways – Feel enthusiastic but cautious about microservices – Be able to design your next project using microservices and Scala – Experience with (almost) production-ready system designed with MSA ● Nope – Yet another REST microframework showcase – 'Microservices will solve all your problems'-type bullshit marketing
  4. ITERATORSI T E R A T O R S @luksow Theory In a nutshell
  5. ITERATORSI T E R A T O R S @luksow What are microservices? ● Architectural style (MSA) ● System is composed of multiple services – Small* – Independently deployed – Communicate using (lightweight) protocols – Organized around business capabilities ● Bounded Context (DDD) or Single Responsibility Principle (OO) implemented in architecture
  6. ITERATORSI T E R A T O R S @luksow Practice For the next ~45 minutes
  7. ITERATORSI T E R A T O R S @luksow Let's design! Design a system that allows users to login/register using FB, email-password or codecard. Authenticated user can subscribe to different events from BTC markets (ex. rate changed, volume over N, ask below M etc.) and get real-time alerts about them. Make sure to gather relevant business metrics. auth-fb auth-pass auth-codes btc-users btc-ws identity metrics session token frontend btc-market load balancer
  8. ITERATORSI T E R A T O R S @luksow Demo In the meanwhile, please download the Internet... $ git clone https://github.com/theiterators/reactive-microservices.git $ cd reactive-microservices $ sbt compile $ # import into your favourite IDE
  9. ITERATORSI T E R A T O R S @luksow Private data stores auth-fb auth-pass auth-codes btc-users btc-ws identity metrics session token btc-market MongoDB Redis PostgreSQL PostgreSQL PostgreSQL MongoDB Event journal
  10. ITERATORSI T E R A T O R S @luksow Shared data stores auth-fb auth-pass auth-codes btc-users btc-ws metrics session btc-market MongoDB token Redis PostgreSQL PostgreSQL PostgreSQL identity MongoDB Event journal
  11. ITERATORSI T E R A T O R S @luksow Metrics flow
  12. ITERATORSI T E R A T O R S @luksow BTC WS state machine
  13. ITERATORSI T E R A T O R S @luksow Summary ● Scala's toolbelt (Akka, Play) is ready for MSA ● Lots of problems and dilemmas on MSA way ● Monoliths are easy :-) ● There are more fine tools for Scala, ex. Finagle ● Production code is only half story, the other is operations, which are extremely hard in MSA
  14. ITERATORSI T E R A T O R S @luksow Hacking time! Yay!
  15. ITERATORSI T E R A T O R S @luksow How to spend next 60 minutes? ● Ideas 1. SPA frontend (Scala.js?) 2. SBT – add Play projects to runAll, clean garbage 3. Metrics – add to other projects 4. Rewrite Play websockets to Akka HTTP websockets 5. Add more BTC markets, update actor protocol 6. Bump dependencies version (migrate to Slick 3, Play 2.4) 7. Simplify streams logic (error handling) 8. Modify business logic (ex. add different authorization levels) 9. Change gateways to use reconnection and/or long-running connections 10. Add new authentication method (ex. G+, SMS) 11. Propose a deployment method (ex. integrate with sbt-assembly or sbt-native-packager) 12. Build deployment environment 13. Integrate with service discovery & configuration management service (ex. ZooKeeper) 14. Think about contract management (ex. integrate with Swagger) 15. Integrate with centralized logging solution (ex. integrate with Logstash) and implement tracing (ex. Correlation-id) 16. Invent a way of testing – single services, subsets or whole solution 17. Your cool idea goes here! ● Subscribe now to http://meetup.com/ScalaWAW to be notified about microservices hackathon in July or August ● Ask me anything! (about ideas, this activator, ScalaWAW, running a software company, ...)
  16. ITERATORSI T E R A T O R S @luksow Thanks! ● Łukasz Sowa ● http://luksow.com ● https://iterato.rs (yes, hiring!) ● contact@luksow.com ● @luksow
Advertisement