SlideShare a Scribd company logo
1 of 19
From Java to Scala at CrowdMix
A one-year journey, growing a set of microservices written in Java 8 into a Scala-based
reactive system
Stefano Galarraga - galarragas@gmail.com - @stefgalarraga
Emanuele Blanco - emanuele.blanco@gmail.com - @manub
What Does Crowdmix Do?
• A social network focused on music
• The model is based on crowds
• People can share different type of content in the crowds they joined
• Music obviously is the most interesting content
• System has been designed for scalability from day 1
• We don’t own any music content but we allow people to share and listen to
tracks across different streaming services
Who are we?
Stefano
• Started (reluctantly) working in Java in 1997
• Worked mostly in Java since then (some C/C++ C#)
• Got interested in Functional Programming around 2011/2012
• Started with Haskell then moved to Scala
• Working primarily in Scala since 2013
• Almost all my open source activity is in Scala
• AKKA enthusiast
• Working mostly in Big Data recently
Who are we?
Emanuele:
• Coding for fun since early 2000s, for profit since 2008
• Comes from a Java/Groovy background
• Started studying Scala in 2011, using it professionally in 2014
• Both Coursera’s courses pre-Scala Center in 2013
• Helpful, but still need real life expertise!
• Creator of scalatest-embedded-kafka (https://github.com/manub/scalatest-
embedded-kafka)
CM Architecture diagram today (“legacy” in red)
Some history - The CM Dev Team and Platform - Start
Early 2015:
A small team of developers, some basic (not so micro)services (profiles, feeds
and music matching)
Tech Stack:
• Java 8
• Dropwizard
• Cassandra
Some history - The CM Dev Team and Platform - Now
Now: Still quite a small team. The team grew up and then recently shrinked
Tech Stack:
• Scala, Cassandra, Kafka
• Rest Services in Spray and some in Play
• AKKA Streams for Kafka Consumers (reactive-kafka)
• Some “pure” AKKA actor code
• Legacy: Java 8, Dropwizard, Groovy (fading away)
• Spark (in Scala) for Batch processing
• Kotlin is gradually replacing Java on the Android part too!!
• And Swift is replacing Objective-C
Some history - The CM Dev Team and Platform
Early 2015
• ~ 5 developers setting up the first microservices (profiles, feeds and music matching) in Java 8 using
Dropwizard
• Scala wasn’t well known by the team, fear of not being able to hire Scala devs
June 2015
• Big (and fast) growth of the tech team, many devs joining coming from Scala experience
• Java 8 - while better than previous versions - still felt verbose for the Scala guys, trying to convince the rest of
the team to adopt Scala for expressiveness and conciseness
September 2015
• First microservices in Scala, new functionalities in feeds service written in Scala, music matching completely
rewritten (for other reasons too)
• Starting to experiment with AKKA Streams (1.0)
• More Scala Devs joining (mostly Big Data)
• Beginning to write first ETL processors in Spark
Some history - The CM Dev Team and Platform
Autumn 2015
• All newly-developed services are in Scala
• AKKA streams is the way to go for Kafka event processors
Today
• Only three services with still some parts in Java
• Some test code is still in Groovy
• All Scala code for the rest
• General consensus about moving everything to Scala
• Of the original set of developers with no Scala background:
• Everyone is capable of maintaining the code and some need some review-supervision
on special parts
• Around half are reasonably fluent in Scala and autonomous
• Others left the team
Some history - The CM Dev Team and Platform
Today:
• Codebase
• Scala code: 1,858 files for 132,926 lines
• Java code: 1,093 files for 93,293 lines
• Groovy code: 237 files 28,120 lines
• Client platform
• iOS: from Objective-C to Swift
• Android: from Java to Kotlin
Moving to Scala - Why
• Many of the devs coming from Scala projects were feeling very limited with
Java, even though Java 8 represents an improvement from earlier versions
• Moving towards a more reactive platform:
• Non blocking async code is much easier to write in Scala (Futures, Actors, Scala Async)
• Scala offers some more lightweight and performing REST framework (such as Spray/AKKA
Http, Finch/Finagle or Play!)
• AKKA Streams are extremely effective to write event processing pipelines
• Quite Java dev friendly too
• Nowadays Scala attracts more talent, people who work in Scala are more likely to pick up
other new technologies instead of “sticking with the well known”
• Beware: “Senior” developers are often reluctant to learn something new!!!
Moving to Scala - Gains
• Attracting/keeping good/right people
• Most of devs with experience in scalable systems were very keen on using Scala
• Most of the developers were asking during interviews how much Java code they would have
had to maintain
• Frameworks:
• Testing frameworks: Much more expressive, compact. Better tests
• Property-based testing, better fixtures
• Initial attempts to get rid of JUnit using Spock (on Groovy) but Scalatest is far superior
• Reactive frameworks:
• See above. Java has good stuff too (Hystrix, ...)
• Data processing layer:
• Spark is available for Java but fits Scala much better
Moving to Scala - Losses
• Need to write fill some gaps:
• Metrics: Out of the box support in Dropwizard, had to integrate/complement for Spray
• Not too much work but need some effort (Kamon + some of our code)
• Circuit breakers: Nothing forces you not to use Hystrix but if you start writing Future-based
API there is a bit of impedance to handle.
• AKKA circuit-breaker is a good replacement with limited features
• API Docs:
• Good support for Swagger in Dropwizard and Jersey. Not so good for Spray
• Still swagger 1.0 and doesn’t interact well with the code (actually found a 2.0
compliant..)
• Need to train/supervise developers
• Small slowdown in the beginning, some entropy to contain in the transition
Moving to Scala - What worked and why
• Had a good percentage of developers with real Scala experience
• Good amount of “cautious” developers, nobody was pushing towards more esoteric Scala
functions
• no Scalaz/Cats, limited usage of implicit conversions and parameters
• Being able to have every Java dev pairing with an experienced Scala one
• While not pairing, active code reviews using PRs
• Data pipeline frameworks are limiting the scope and helping to avoid getting
lost in Scala land
• Spark, AKKA Streams
• Almost everybody seemed keen to learn Scala and to port Java code
• No “rewrite everything” approach; instead
• New code gets preferably written in Scala
• Old code gets ported when there’s business need to change it
Moving to Scala - What didn’t work so well
• Keeping REST Java output code in Java and replacing the service layer in
Scala
• Calling Scala code from Java is painful
• Problems in writing a non-blocking service layer, ended up limiting the amount of gain
• ListenableFuture and CompletionStage may translate into Scala Futures with some help
• I would probably move in the opposite way and then replace the Java code entirely
• Gradle and ScalaTest don’t really work seamlessly…
• It’s easy to forget @RunWith
• sbt is still the best option to build Scala, but it’s not the easiest tool around
• Scala is great, but the compiler is still way slower than javac
• Dotty to the rescue? http://scala-lang.org/news/roadmap-next/
Summary
• It worked for us
• We are not a common case probably
• Limited legacy
• Good Scala expertise in the team
• Suggestions for other trying to do the same:
• Get scala devs with real development experience to pair/mentor
• Not just having completed the Coursera courses => they maintained sw written in Scala
• Spread them around
• Stick to the Principle of Least Power
http://www.lihaoyi.com/post/StrategicScalaStylePrincipleofLeastPower.html
• Adopt a strict “simplified scala” strategy for the beginning
• Play is usually a good gateway drug
• Spray, AKKA HTTP is not
• Consider Finch/Finatra/Finagle
Summary
From: http://blog.goodstuff.im/yes-virginia-scala-is-hard (very old post!!)
So, how can you figure out if Scala will be "easy" or "hard" for your organization:
Your company has speakers at JavaOne, OSCON, Strangle Loop, QCon: Scala will be easy
Lunch-time discussions involve the criteria for moving from a developer to a senior developer: Scala
will be hard
Your developers can write code in NotePad if they have to: Easy
Your developers stare blankly or say 3 "Hail Marys" when they hear the name "Zed Shaw": Scala == Hard
Developers all follow Dean Wampler on Twitter: Scala Easy
Your developers come in at 9:15 and leave before 6 and don't check work email at night: Hard
Summary
Questions?

More Related Content

What's hot

Deploying Complex Applications on Docker using Apache Brooklyn
Deploying Complex Applications on Docker using Apache BrooklynDeploying Complex Applications on Docker using Apache Brooklyn
Deploying Complex Applications on Docker using Apache BrooklynAndrew Kennedy
 
Pakk Your Alpakka: Reactive Streams Integrations For AWS, Azure, & Google Cloud
Pakk Your Alpakka: Reactive Streams Integrations For AWS, Azure, & Google CloudPakk Your Alpakka: Reactive Streams Integrations For AWS, Azure, & Google Cloud
Pakk Your Alpakka: Reactive Streams Integrations For AWS, Azure, & Google CloudLightbend
 
Livy: A REST Web Service For Apache Spark
Livy: A REST Web Service For Apache SparkLivy: A REST Web Service For Apache Spark
Livy: A REST Web Service For Apache SparkJen Aman
 
A Deeper Look Into Reactive Streams with Akka Streams 1.0 and Slick 3.0
A Deeper Look Into Reactive Streams with Akka Streams 1.0 and Slick 3.0A Deeper Look Into Reactive Streams with Akka Streams 1.0 and Slick 3.0
A Deeper Look Into Reactive Streams with Akka Streams 1.0 and Slick 3.0Legacy Typesafe (now Lightbend)
 
A Journey to Reactive Function Programming
A Journey to Reactive Function ProgrammingA Journey to Reactive Function Programming
A Journey to Reactive Function ProgrammingAhmed Soliman
 
Whirlpools in the Stream with Jayesh Lalwani
 Whirlpools in the Stream with Jayesh Lalwani Whirlpools in the Stream with Jayesh Lalwani
Whirlpools in the Stream with Jayesh LalwaniDatabricks
 
Making Scala Faster: 3 Expert Tips For Busy Development Teams
Making Scala Faster: 3 Expert Tips For Busy Development TeamsMaking Scala Faster: 3 Expert Tips For Busy Development Teams
Making Scala Faster: 3 Expert Tips For Busy Development TeamsLightbend
 
Putting Kafka In Jail – Best Practices To Run Kafka On Kubernetes & DC/OS
Putting Kafka In Jail – Best Practices To Run Kafka On Kubernetes & DC/OSPutting Kafka In Jail – Best Practices To Run Kafka On Kubernetes & DC/OS
Putting Kafka In Jail – Best Practices To Run Kafka On Kubernetes & DC/OSLightbend
 
Stream Collections - Scala Days
Stream Collections - Scala DaysStream Collections - Scala Days
Stream Collections - Scala DaysGreg Silin
 
Gradual migration to MicroProfile
Gradual migration to MicroProfileGradual migration to MicroProfile
Gradual migration to MicroProfileRudy De Busscher
 
Zeppelin meetup 2016 madrid
Zeppelin meetup 2016 madridZeppelin meetup 2016 madrid
Zeppelin meetup 2016 madridJongyoul Lee
 
MicroServices for Java Developers
MicroServices for Java Developers MicroServices for Java Developers
MicroServices for Java Developers Red Hat Developers
 
Empowering Zillow’s Developers with Self-Service ETL
Empowering Zillow’s Developers with Self-Service ETLEmpowering Zillow’s Developers with Self-Service ETL
Empowering Zillow’s Developers with Self-Service ETLDatabricks
 
Lightbend Training for Scala, Akka, Play Framework and Apache Spark
Lightbend Training for Scala, Akka, Play Framework and Apache SparkLightbend Training for Scala, Akka, Play Framework and Apache Spark
Lightbend Training for Scala, Akka, Play Framework and Apache SparkLightbend
 
Sneaking Scala through the Back Door
Sneaking Scala through the Back DoorSneaking Scala through the Back Door
Sneaking Scala through the Back DoorDianne Marsh
 
Modern DevOps across Technologies on premises and clouds with Oracle Manageme...
Modern DevOps across Technologies on premises and clouds with Oracle Manageme...Modern DevOps across Technologies on premises and clouds with Oracle Manageme...
Modern DevOps across Technologies on premises and clouds with Oracle Manageme...Lucas Jellema
 
Monitor Micro-service with MicroProfile metrics
Monitor Micro-service with MicroProfile metricsMonitor Micro-service with MicroProfile metrics
Monitor Micro-service with MicroProfile metricsRudy De Busscher
 
Scala adoption by enterprises
Scala adoption by enterprisesScala adoption by enterprises
Scala adoption by enterprisesMike Slinn
 
AWS re:Invent 2016: Open-Source Resources (DCS201)
AWS re:Invent 2016: Open-Source Resources (DCS201)AWS re:Invent 2016: Open-Source Resources (DCS201)
AWS re:Invent 2016: Open-Source Resources (DCS201)Amazon Web Services
 
Transactions in micro-services (fall 2019)
Transactions in micro-services (fall 2019)Transactions in micro-services (fall 2019)
Transactions in micro-services (fall 2019)Rudy De Busscher
 

What's hot (20)

Deploying Complex Applications on Docker using Apache Brooklyn
Deploying Complex Applications on Docker using Apache BrooklynDeploying Complex Applications on Docker using Apache Brooklyn
Deploying Complex Applications on Docker using Apache Brooklyn
 
Pakk Your Alpakka: Reactive Streams Integrations For AWS, Azure, & Google Cloud
Pakk Your Alpakka: Reactive Streams Integrations For AWS, Azure, & Google CloudPakk Your Alpakka: Reactive Streams Integrations For AWS, Azure, & Google Cloud
Pakk Your Alpakka: Reactive Streams Integrations For AWS, Azure, & Google Cloud
 
Livy: A REST Web Service For Apache Spark
Livy: A REST Web Service For Apache SparkLivy: A REST Web Service For Apache Spark
Livy: A REST Web Service For Apache Spark
 
A Deeper Look Into Reactive Streams with Akka Streams 1.0 and Slick 3.0
A Deeper Look Into Reactive Streams with Akka Streams 1.0 and Slick 3.0A Deeper Look Into Reactive Streams with Akka Streams 1.0 and Slick 3.0
A Deeper Look Into Reactive Streams with Akka Streams 1.0 and Slick 3.0
 
A Journey to Reactive Function Programming
A Journey to Reactive Function ProgrammingA Journey to Reactive Function Programming
A Journey to Reactive Function Programming
 
Whirlpools in the Stream with Jayesh Lalwani
 Whirlpools in the Stream with Jayesh Lalwani Whirlpools in the Stream with Jayesh Lalwani
Whirlpools in the Stream with Jayesh Lalwani
 
Making Scala Faster: 3 Expert Tips For Busy Development Teams
Making Scala Faster: 3 Expert Tips For Busy Development TeamsMaking Scala Faster: 3 Expert Tips For Busy Development Teams
Making Scala Faster: 3 Expert Tips For Busy Development Teams
 
Putting Kafka In Jail – Best Practices To Run Kafka On Kubernetes & DC/OS
Putting Kafka In Jail – Best Practices To Run Kafka On Kubernetes & DC/OSPutting Kafka In Jail – Best Practices To Run Kafka On Kubernetes & DC/OS
Putting Kafka In Jail – Best Practices To Run Kafka On Kubernetes & DC/OS
 
Stream Collections - Scala Days
Stream Collections - Scala DaysStream Collections - Scala Days
Stream Collections - Scala Days
 
Gradual migration to MicroProfile
Gradual migration to MicroProfileGradual migration to MicroProfile
Gradual migration to MicroProfile
 
Zeppelin meetup 2016 madrid
Zeppelin meetup 2016 madridZeppelin meetup 2016 madrid
Zeppelin meetup 2016 madrid
 
MicroServices for Java Developers
MicroServices for Java Developers MicroServices for Java Developers
MicroServices for Java Developers
 
Empowering Zillow’s Developers with Self-Service ETL
Empowering Zillow’s Developers with Self-Service ETLEmpowering Zillow’s Developers with Self-Service ETL
Empowering Zillow’s Developers with Self-Service ETL
 
Lightbend Training for Scala, Akka, Play Framework and Apache Spark
Lightbend Training for Scala, Akka, Play Framework and Apache SparkLightbend Training for Scala, Akka, Play Framework and Apache Spark
Lightbend Training for Scala, Akka, Play Framework and Apache Spark
 
Sneaking Scala through the Back Door
Sneaking Scala through the Back DoorSneaking Scala through the Back Door
Sneaking Scala through the Back Door
 
Modern DevOps across Technologies on premises and clouds with Oracle Manageme...
Modern DevOps across Technologies on premises and clouds with Oracle Manageme...Modern DevOps across Technologies on premises and clouds with Oracle Manageme...
Modern DevOps across Technologies on premises and clouds with Oracle Manageme...
 
Monitor Micro-service with MicroProfile metrics
Monitor Micro-service with MicroProfile metricsMonitor Micro-service with MicroProfile metrics
Monitor Micro-service with MicroProfile metrics
 
Scala adoption by enterprises
Scala adoption by enterprisesScala adoption by enterprises
Scala adoption by enterprises
 
AWS re:Invent 2016: Open-Source Resources (DCS201)
AWS re:Invent 2016: Open-Source Resources (DCS201)AWS re:Invent 2016: Open-Source Resources (DCS201)
AWS re:Invent 2016: Open-Source Resources (DCS201)
 
Transactions in micro-services (fall 2019)
Transactions in micro-services (fall 2019)Transactions in micro-services (fall 2019)
Transactions in micro-services (fall 2019)
 

Viewers also liked

New Era of Software with modern Application Security (v0.6)
New Era of Software with modern Application Security (v0.6)New Era of Software with modern Application Security (v0.6)
New Era of Software with modern Application Security (v0.6)Dinis Cruz
 
Databus - LinkedIn's Change Data Capture Pipeline
Databus - LinkedIn's Change Data Capture PipelineDatabus - LinkedIn's Change Data Capture Pipeline
Databus - LinkedIn's Change Data Capture PipelineSunil Nagaraj
 
Day 5 - Real-time Data Processing/Internet of Things (IoT) with Amazon Kinesis
Day 5 - Real-time Data Processing/Internet of Things (IoT) with Amazon KinesisDay 5 - Real-time Data Processing/Internet of Things (IoT) with Amazon Kinesis
Day 5 - Real-time Data Processing/Internet of Things (IoT) with Amazon KinesisAmazon Web Services
 
Building a Reactive RESTful API with Akka Http & Slick
Building a Reactive RESTful API with Akka Http & SlickBuilding a Reactive RESTful API with Akka Http & Slick
Building a Reactive RESTful API with Akka Http & SlickZalando Technology
 
Intro to Apache Apex - Next Gen Platform for Ingest and Transform
Intro to Apache Apex - Next Gen Platform for Ingest and TransformIntro to Apache Apex - Next Gen Platform for Ingest and Transform
Intro to Apache Apex - Next Gen Platform for Ingest and TransformApache Apex
 
Real time data viz with Spark Streaming, Kafka and D3.js
Real time data viz with Spark Streaming, Kafka and D3.jsReal time data viz with Spark Streaming, Kafka and D3.js
Real time data viz with Spark Streaming, Kafka and D3.jsBen Laird
 

Viewers also liked (6)

New Era of Software with modern Application Security (v0.6)
New Era of Software with modern Application Security (v0.6)New Era of Software with modern Application Security (v0.6)
New Era of Software with modern Application Security (v0.6)
 
Databus - LinkedIn's Change Data Capture Pipeline
Databus - LinkedIn's Change Data Capture PipelineDatabus - LinkedIn's Change Data Capture Pipeline
Databus - LinkedIn's Change Data Capture Pipeline
 
Day 5 - Real-time Data Processing/Internet of Things (IoT) with Amazon Kinesis
Day 5 - Real-time Data Processing/Internet of Things (IoT) with Amazon KinesisDay 5 - Real-time Data Processing/Internet of Things (IoT) with Amazon Kinesis
Day 5 - Real-time Data Processing/Internet of Things (IoT) with Amazon Kinesis
 
Building a Reactive RESTful API with Akka Http & Slick
Building a Reactive RESTful API with Akka Http & SlickBuilding a Reactive RESTful API with Akka Http & Slick
Building a Reactive RESTful API with Akka Http & Slick
 
Intro to Apache Apex - Next Gen Platform for Ingest and Transform
Intro to Apache Apex - Next Gen Platform for Ingest and TransformIntro to Apache Apex - Next Gen Platform for Ingest and Transform
Intro to Apache Apex - Next Gen Platform for Ingest and Transform
 
Real time data viz with Spark Streaming, Kafka and D3.js
Real time data viz with Spark Streaming, Kafka and D3.jsReal time data viz with Spark Streaming, Kafka and D3.js
Real time data viz with Spark Streaming, Kafka and D3.js
 

Similar to From java to scala at crowd mix

Experience Converting from Ruby to Scala
Experience Converting from Ruby to ScalaExperience Converting from Ruby to Scala
Experience Converting from Ruby to ScalaJohn Nestor
 
Whitepages Practical Experience Converting from Ruby to Reactive
Whitepages Practical Experience Converting from Ruby to ReactiveWhitepages Practical Experience Converting from Ruby to Reactive
Whitepages Practical Experience Converting from Ruby to ReactiveDragos Manolescu
 
Java to scala
Java to scalaJava to scala
Java to scalaGiltTech
 
Scala in practice
Scala in practiceScala in practice
Scala in practiceTomer Gabel
 
Functional Scala 2022 - scalajs Alexis.pdf
Functional Scala 2022 - scalajs Alexis.pdfFunctional Scala 2022 - scalajs Alexis.pdf
Functional Scala 2022 - scalajs Alexis.pdfssusercd195b
 
Challenges of moving a java team to scala
Challenges of moving a java team to scalaChallenges of moving a java team to scala
Challenges of moving a java team to scalaJoão Cavalheiro
 
Play Architecture, Implementation, Shiny Objects, and a Proposal
Play Architecture, Implementation, Shiny Objects, and a ProposalPlay Architecture, Implementation, Shiny Objects, and a Proposal
Play Architecture, Implementation, Shiny Objects, and a ProposalMike Slinn
 
Scala for java developers 6 may 2017 - yeni
Scala for java developers   6 may 2017 - yeniScala for java developers   6 may 2017 - yeni
Scala for java developers 6 may 2017 - yeniBaris Dere
 
Tips For Maintaining OSS Projects
Tips For Maintaining OSS ProjectsTips For Maintaining OSS Projects
Tips For Maintaining OSS ProjectsTaro L. Saito
 
Evolving IGN’s New APIs with Scala
 Evolving IGN’s New APIs with Scala Evolving IGN’s New APIs with Scala
Evolving IGN’s New APIs with ScalaManish Pandit
 
Scala Native: Ahead of Time
Scala Native: Ahead of TimeScala Native: Ahead of Time
Scala Native: Ahead of TimeNadav Wiener
 
Scala and Spark are Ideal for Big Data
Scala and Spark are Ideal for Big DataScala and Spark are Ideal for Big Data
Scala and Spark are Ideal for Big DataJohn Nestor
 
Scala and Spark are Ideal for Big Data - Data Science Pop-up Seattle
Scala and Spark are Ideal for Big Data - Data Science Pop-up SeattleScala and Spark are Ideal for Big Data - Data Science Pop-up Seattle
Scala and Spark are Ideal for Big Data - Data Science Pop-up SeattleDomino Data Lab
 
Scala & Spark Online Training
Scala & Spark Online TrainingScala & Spark Online Training
Scala & Spark Online TrainingLearntek1
 
Scala for android
Scala for androidScala for android
Scala for androidTack Mobile
 

Similar to From java to scala at crowd mix (20)

Experience Converting from Ruby to Scala
Experience Converting from Ruby to ScalaExperience Converting from Ruby to Scala
Experience Converting from Ruby to Scala
 
Whitepages Practical Experience Converting from Ruby to Reactive
Whitepages Practical Experience Converting from Ruby to ReactiveWhitepages Practical Experience Converting from Ruby to Reactive
Whitepages Practical Experience Converting from Ruby to Reactive
 
Java to scala
Java to scalaJava to scala
Java to scala
 
Scala in practice
Scala in practiceScala in practice
Scala in practice
 
Functional Scala 2022 - scalajs Alexis.pdf
Functional Scala 2022 - scalajs Alexis.pdfFunctional Scala 2022 - scalajs Alexis.pdf
Functional Scala 2022 - scalajs Alexis.pdf
 
Challenges of moving a java team to scala
Challenges of moving a java team to scalaChallenges of moving a java team to scala
Challenges of moving a java team to scala
 
Play Architecture, Implementation, Shiny Objects, and a Proposal
Play Architecture, Implementation, Shiny Objects, and a ProposalPlay Architecture, Implementation, Shiny Objects, and a Proposal
Play Architecture, Implementation, Shiny Objects, and a Proposal
 
Scala for java developers 6 may 2017 - yeni
Scala for java developers   6 may 2017 - yeniScala for java developers   6 may 2017 - yeni
Scala for java developers 6 may 2017 - yeni
 
Tips For Maintaining OSS Projects
Tips For Maintaining OSS ProjectsTips For Maintaining OSS Projects
Tips For Maintaining OSS Projects
 
Stackato v4
Stackato v4Stackato v4
Stackato v4
 
Evolving IGN’s New APIs with Scala
 Evolving IGN’s New APIs with Scala Evolving IGN’s New APIs with Scala
Evolving IGN’s New APIs with Scala
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
Scala Native: Ahead of Time
Scala Native: Ahead of TimeScala Native: Ahead of Time
Scala Native: Ahead of Time
 
Stackato v2
Stackato v2Stackato v2
Stackato v2
 
Stackato
StackatoStackato
Stackato
 
Scala and Spark are Ideal for Big Data
Scala and Spark are Ideal for Big DataScala and Spark are Ideal for Big Data
Scala and Spark are Ideal for Big Data
 
Scala and Spark are Ideal for Big Data - Data Science Pop-up Seattle
Scala and Spark are Ideal for Big Data - Data Science Pop-up SeattleScala and Spark are Ideal for Big Data - Data Science Pop-up Seattle
Scala and Spark are Ideal for Big Data - Data Science Pop-up Seattle
 
Scala & Spark Online Training
Scala & Spark Online TrainingScala & Spark Online Training
Scala & Spark Online Training
 
Stackato v6
Stackato v6Stackato v6
Stackato v6
 
Scala for android
Scala for androidScala for android
Scala for android
 

Recently uploaded

Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 

Recently uploaded (20)

Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 

From java to scala at crowd mix

  • 1. From Java to Scala at CrowdMix A one-year journey, growing a set of microservices written in Java 8 into a Scala-based reactive system Stefano Galarraga - galarragas@gmail.com - @stefgalarraga Emanuele Blanco - emanuele.blanco@gmail.com - @manub
  • 2. What Does Crowdmix Do? • A social network focused on music • The model is based on crowds • People can share different type of content in the crowds they joined • Music obviously is the most interesting content • System has been designed for scalability from day 1 • We don’t own any music content but we allow people to share and listen to tracks across different streaming services
  • 3. Who are we? Stefano • Started (reluctantly) working in Java in 1997 • Worked mostly in Java since then (some C/C++ C#) • Got interested in Functional Programming around 2011/2012 • Started with Haskell then moved to Scala • Working primarily in Scala since 2013 • Almost all my open source activity is in Scala • AKKA enthusiast • Working mostly in Big Data recently
  • 4. Who are we? Emanuele: • Coding for fun since early 2000s, for profit since 2008 • Comes from a Java/Groovy background • Started studying Scala in 2011, using it professionally in 2014 • Both Coursera’s courses pre-Scala Center in 2013 • Helpful, but still need real life expertise! • Creator of scalatest-embedded-kafka (https://github.com/manub/scalatest- embedded-kafka)
  • 5. CM Architecture diagram today (“legacy” in red)
  • 6. Some history - The CM Dev Team and Platform - Start Early 2015: A small team of developers, some basic (not so micro)services (profiles, feeds and music matching) Tech Stack: • Java 8 • Dropwizard • Cassandra
  • 7. Some history - The CM Dev Team and Platform - Now Now: Still quite a small team. The team grew up and then recently shrinked Tech Stack: • Scala, Cassandra, Kafka • Rest Services in Spray and some in Play • AKKA Streams for Kafka Consumers (reactive-kafka) • Some “pure” AKKA actor code • Legacy: Java 8, Dropwizard, Groovy (fading away) • Spark (in Scala) for Batch processing • Kotlin is gradually replacing Java on the Android part too!! • And Swift is replacing Objective-C
  • 8. Some history - The CM Dev Team and Platform Early 2015 • ~ 5 developers setting up the first microservices (profiles, feeds and music matching) in Java 8 using Dropwizard • Scala wasn’t well known by the team, fear of not being able to hire Scala devs June 2015 • Big (and fast) growth of the tech team, many devs joining coming from Scala experience • Java 8 - while better than previous versions - still felt verbose for the Scala guys, trying to convince the rest of the team to adopt Scala for expressiveness and conciseness September 2015 • First microservices in Scala, new functionalities in feeds service written in Scala, music matching completely rewritten (for other reasons too) • Starting to experiment with AKKA Streams (1.0) • More Scala Devs joining (mostly Big Data) • Beginning to write first ETL processors in Spark
  • 9. Some history - The CM Dev Team and Platform Autumn 2015 • All newly-developed services are in Scala • AKKA streams is the way to go for Kafka event processors Today • Only three services with still some parts in Java • Some test code is still in Groovy • All Scala code for the rest • General consensus about moving everything to Scala • Of the original set of developers with no Scala background: • Everyone is capable of maintaining the code and some need some review-supervision on special parts • Around half are reasonably fluent in Scala and autonomous • Others left the team
  • 10. Some history - The CM Dev Team and Platform Today: • Codebase • Scala code: 1,858 files for 132,926 lines • Java code: 1,093 files for 93,293 lines • Groovy code: 237 files 28,120 lines • Client platform • iOS: from Objective-C to Swift • Android: from Java to Kotlin
  • 11. Moving to Scala - Why • Many of the devs coming from Scala projects were feeling very limited with Java, even though Java 8 represents an improvement from earlier versions • Moving towards a more reactive platform: • Non blocking async code is much easier to write in Scala (Futures, Actors, Scala Async) • Scala offers some more lightweight and performing REST framework (such as Spray/AKKA Http, Finch/Finagle or Play!) • AKKA Streams are extremely effective to write event processing pipelines • Quite Java dev friendly too • Nowadays Scala attracts more talent, people who work in Scala are more likely to pick up other new technologies instead of “sticking with the well known” • Beware: “Senior” developers are often reluctant to learn something new!!!
  • 12. Moving to Scala - Gains • Attracting/keeping good/right people • Most of devs with experience in scalable systems were very keen on using Scala • Most of the developers were asking during interviews how much Java code they would have had to maintain • Frameworks: • Testing frameworks: Much more expressive, compact. Better tests • Property-based testing, better fixtures • Initial attempts to get rid of JUnit using Spock (on Groovy) but Scalatest is far superior • Reactive frameworks: • See above. Java has good stuff too (Hystrix, ...) • Data processing layer: • Spark is available for Java but fits Scala much better
  • 13. Moving to Scala - Losses • Need to write fill some gaps: • Metrics: Out of the box support in Dropwizard, had to integrate/complement for Spray • Not too much work but need some effort (Kamon + some of our code) • Circuit breakers: Nothing forces you not to use Hystrix but if you start writing Future-based API there is a bit of impedance to handle. • AKKA circuit-breaker is a good replacement with limited features • API Docs: • Good support for Swagger in Dropwizard and Jersey. Not so good for Spray • Still swagger 1.0 and doesn’t interact well with the code (actually found a 2.0 compliant..) • Need to train/supervise developers • Small slowdown in the beginning, some entropy to contain in the transition
  • 14. Moving to Scala - What worked and why • Had a good percentage of developers with real Scala experience • Good amount of “cautious” developers, nobody was pushing towards more esoteric Scala functions • no Scalaz/Cats, limited usage of implicit conversions and parameters • Being able to have every Java dev pairing with an experienced Scala one • While not pairing, active code reviews using PRs • Data pipeline frameworks are limiting the scope and helping to avoid getting lost in Scala land • Spark, AKKA Streams • Almost everybody seemed keen to learn Scala and to port Java code • No “rewrite everything” approach; instead • New code gets preferably written in Scala • Old code gets ported when there’s business need to change it
  • 15. Moving to Scala - What didn’t work so well • Keeping REST Java output code in Java and replacing the service layer in Scala • Calling Scala code from Java is painful • Problems in writing a non-blocking service layer, ended up limiting the amount of gain • ListenableFuture and CompletionStage may translate into Scala Futures with some help • I would probably move in the opposite way and then replace the Java code entirely • Gradle and ScalaTest don’t really work seamlessly… • It’s easy to forget @RunWith • sbt is still the best option to build Scala, but it’s not the easiest tool around • Scala is great, but the compiler is still way slower than javac • Dotty to the rescue? http://scala-lang.org/news/roadmap-next/
  • 16. Summary • It worked for us • We are not a common case probably • Limited legacy • Good Scala expertise in the team • Suggestions for other trying to do the same: • Get scala devs with real development experience to pair/mentor • Not just having completed the Coursera courses => they maintained sw written in Scala • Spread them around • Stick to the Principle of Least Power http://www.lihaoyi.com/post/StrategicScalaStylePrincipleofLeastPower.html • Adopt a strict “simplified scala” strategy for the beginning • Play is usually a good gateway drug • Spray, AKKA HTTP is not • Consider Finch/Finatra/Finagle
  • 17. Summary From: http://blog.goodstuff.im/yes-virginia-scala-is-hard (very old post!!) So, how can you figure out if Scala will be "easy" or "hard" for your organization: Your company has speakers at JavaOne, OSCON, Strangle Loop, QCon: Scala will be easy Lunch-time discussions involve the criteria for moving from a developer to a senior developer: Scala will be hard Your developers can write code in NotePad if they have to: Easy Your developers stare blankly or say 3 "Hail Marys" when they hear the name "Zed Shaw": Scala == Hard Developers all follow Dean Wampler on Twitter: Scala Easy Your developers come in at 9:15 and leave before 6 and don't check work email at night: Hard

Editor's Notes

  1. Ste
  2. Ste
  3. Ema
  4. Ste + Ema
  5. Ema We should describe the situation at company startup, the kind of developer, why Java 8 was chosen
  6. Ema We could describe the size changes 5 - 20 - 12
  7. Stefano Are dates correct, any other hot milestone? You are the best on it Ema, since you did most of the initial injection work
  8. Stefano
  9. Need to collect the stats
  10. Ema Any other good reason? I added the fact people that do Scala are generally more keen to learn
  11. Ema
  12. Ema/Ste
  13. Ste
  14. Ste/Ema I added the fact that if you have ListenableFuture or CompletionStage you can work with Scala futures, but it require
  15. Ste