SlideShare a Scribd company logo
1 of 28
Download to read offline
From No Services to
Microservices
A journey of a FinTech application into the cloud, starting as a monolith and
growing to MicroServices. Why going functional is so good for finance
technology, and how Scala helped us build a better application.
João Cavalheiro - e.Near
joao.cavalheiro@enear.co
Fintech in a Nutshell
• Fintech is mostly about using technology to
make financial services more efficient.
• Fintech companies are in many cases startups,
and have the purpose of disrupting existing
financial systems.
• Popular areas are payments & lending,
blockchain and market monitoring and tracking
Developing Fintech Software
• Complex business models
• Data security
• Code stability and adaptability
• Quality of service (QOS)
Your programming language, team skills and
toolkit must be able to deal with all the above
Avoid
• Non-Agile development processes
• Growing the team too quickly
• Start writing code before you understand the
business model
Go Functional
• Intent over implementation
• Immutability - correct code by design
• Transparent concurrency
• Use conventions and patterns
Use Scala(you should)
• Focus on easiness of refactoring instead of elite-
looking code
• Do not abuse implicits!
• Part of our team was moving from Java, so..
Leverage on Java
Ecosystem
• Lots of useful Java libraries out there. You can
use them in your Scala project
• Don’t feel guilty for using OO design in your first
days in Scala
• All JVM concepts can be applied
Why Starting with a Monolith
can be Good
• Fintech companies sometimes grow really fast
• The business model is a moving part
• Logical option is to invest time on a carefully
designed monolith
• It would be simpler to move to microservices
later
Monolith Design
• Logical option is to invest time on a carefully
designed monolith
Monolith Design
• Should be adjusted to business and product
requirements
• Sometimes is just better to focus initially on your
monolith functionality and gradually peel off
microservices at the edges
• You can also sacrifice your currently architecture
and go for a complete system redesign
Our Application
• Software-as-a-Service
• Core micro-finance system
• Combines administration, security, accounting,
loan portfolio management and deposit tracking
• Currently in production with 20 paying
customers (MFI banks) and over 400.000 end
clients.
Initial Tech Stack
• Using Scala and Play! framework
• PostgresSQL database
The Data Model
• Data model is event-based, every operation over
an account is an event
• Repayment schedules are stored in the
database, one row per instalment
• We also keep track of all non-transaction actions
on the system
The Hit on The Wall
• We reached 200.000 lines of code on our
monolith play! Application.
• It was getting hard to keep development under
control
• Bug density was increasing with the product
complexity
• And we had a few demanding requirements…
Business talks
• Operations, including transactions, can be
backdated and reverted, any moment in time
• It is in fact, possible to change the past
• We could not rely on a simple snapshotting
model. The snapshots in the past could change,
and they would affect all the subsequent
snapshots as well.
Headed for Microservices
• Services that are themselves very simple,
focusing on doing one thing well
• Use different languages/frameworks and tools for
each service
• Integrate new team members much easier
The First Microservice
• Our immediate need was to find a dynamic
snapshot solution to accommodate transaction
backdating and have the updated detailed status
of each account, for at least the last 30 days
• This could never operate on top of current
application stack and database
• We had a great candidate for the first
microservice
Landscape
CQRS
• The concept at the heart of it is to use a different
model to create/update information than the
model you use to read information
• It adds complexity, but we were going to use it
only on specific portions of the system
• It allowed us to define separate materialised
query views that implement the aggregation
strategy for account transactions
The outcome
• The view model It’s eventually consistent, but
reports are in most cases statistical, and
therefore “almost-real-time” is acceptable
• Denormalized = Efficiency lookup
• All seemed great!
The Dark Side
The doubts
• Can we share a single database?
• How do we manage dependencies?
• Multiple code bases, multiple git repos &
branching models
The Next Service and
experience with AKKA HTTP
• The need to add document management to our
product and to do it with a scalable solution
• We needed something lighter than Play!
• Spray is no longer actively developed
• AKKA-http?
AKKA-http
• It was a moving target. Api stability was not
proven
• It doesn’t work right out of the box
• Should we fall back to Play?
AKKA-http
• With Akka-http you can choose and control each
component of your solution
• Add new components with a smaller risk
• Easier to find and fix problems
• But, if you are short on time, under pressure, and you
don’t know Spray or Akka-http at all, consider Play
It worked in DEV…
• AKKA-http proved to be a good solution
• Microservices were helping
• Performance was improved
• But, someone was not happy…
“… OPS problem now”
• Microservices come with operations overhead:
• Monitoring
• Deployment
• Security
• Seriously consider to have DEVOPS
What we Learned
• Moving to microservices is not a silver bullet,
and the increased complexity means there are a
lot of areas which need to be carefully
considered
• All in all, microservices are not a free lunch, but
in many cases it’s a worthwhile investment
• Scala made it easier!

More Related Content

What's hot

What's hot (20)

Digital Transformation in Market Data and Trading Platforms
Digital Transformation in Market Data and Trading PlatformsDigital Transformation in Market Data and Trading Platforms
Digital Transformation in Market Data and Trading Platforms
 
Open Banking - Moving Banks Beyond the Norm
Open Banking - Moving Banks Beyond the NormOpen Banking - Moving Banks Beyond the Norm
Open Banking - Moving Banks Beyond the Norm
 
Awesome Banking API's
Awesome Banking API'sAwesome Banking API's
Awesome Banking API's
 
Does your API need to be PCI Compliant?
Does your API need to be PCI Compliant?Does your API need to be PCI Compliant?
Does your API need to be PCI Compliant?
 
Forecast deploy3 100_ak2
Forecast deploy3 100_ak2Forecast deploy3 100_ak2
Forecast deploy3 100_ak2
 
DevDay: Managing a Distributed Network on a Common Infra, SIA
DevDay: Managing a Distributed Network on a Common Infra, SIADevDay: Managing a Distributed Network on a Common Infra, SIA
DevDay: Managing a Distributed Network on a Common Infra, SIA
 
Driving Digital Transformation through Big Data Analytics and Machine Learning
Driving Digital Transformation through Big Data Analytics and Machine LearningDriving Digital Transformation through Big Data Analytics and Machine Learning
Driving Digital Transformation through Big Data Analytics and Machine Learning
 
WHAT'S NEW IN MULE 4.X – NEW ENHANCEMENTS AND CAPABILITIES
WHAT'S NEW IN MULE 4.X – NEW ENHANCEMENTS AND CAPABILITIESWHAT'S NEW IN MULE 4.X – NEW ENHANCEMENTS AND CAPABILITIES
WHAT'S NEW IN MULE 4.X – NEW ENHANCEMENTS AND CAPABILITIES
 
IBM Cloud Côte d'Azur Meetup - Blockchain Business Processes & Rule-based Sm...
IBM Cloud Côte d'Azur Meetup - Blockchain Business Processes &  Rule-based Sm...IBM Cloud Côte d'Azur Meetup - Blockchain Business Processes &  Rule-based Sm...
IBM Cloud Côte d'Azur Meetup - Blockchain Business Processes & Rule-based Sm...
 
[WSO2Con EU 2017] Travis Perkins - Our Digital Transformation & the Importanc...
[WSO2Con EU 2017] Travis Perkins - Our Digital Transformation & the Importanc...[WSO2Con EU 2017] Travis Perkins - Our Digital Transformation & the Importanc...
[WSO2Con EU 2017] Travis Perkins - Our Digital Transformation & the Importanc...
 
[WSO2Con EU 2018] Simplifying Digital Transformation with an "API Aware" Mindset
[WSO2Con EU 2018] Simplifying Digital Transformation with an "API Aware" Mindset[WSO2Con EU 2018] Simplifying Digital Transformation with an "API Aware" Mindset
[WSO2Con EU 2018] Simplifying Digital Transformation with an "API Aware" Mindset
 
apidays LIVE Hong Kong 2021 - Modernizing Monolith Applications with API Arch...
apidays LIVE Hong Kong 2021 - Modernizing Monolith Applications with API Arch...apidays LIVE Hong Kong 2021 - Modernizing Monolith Applications with API Arch...
apidays LIVE Hong Kong 2021 - Modernizing Monolith Applications with API Arch...
 
Nyctale - Pitch deck
Nyctale - Pitch deckNyctale - Pitch deck
Nyctale - Pitch deck
 
DevDay: Managing a Distributed Network on a Common Infra, NTT Data
DevDay: Managing a Distributed Network on a Common Infra, NTT DataDevDay: Managing a Distributed Network on a Common Infra, NTT Data
DevDay: Managing a Distributed Network on a Common Infra, NTT Data
 
Invansys Technologies
Invansys TechnologiesInvansys Technologies
Invansys Technologies
 
Open Banking via API Connect & DataPower
Open Banking via API Connect & DataPowerOpen Banking via API Connect & DataPower
Open Banking via API Connect & DataPower
 
Oracle Blockchain Experience Day
Oracle Blockchain Experience DayOracle Blockchain Experience Day
Oracle Blockchain Experience Day
 
Built on Pulsar: A Commercial Consent Management System for 80 Million Citizens
Built on Pulsar: A Commercial Consent Management System for 80 Million CitizensBuilt on Pulsar: A Commercial Consent Management System for 80 Million Citizens
Built on Pulsar: A Commercial Consent Management System for 80 Million Citizens
 
A MARKETER'S GUIDE : " INTEGRATION PLATFORM AS A SERVICE (iPaaS) "
A MARKETER'S GUIDE : " INTEGRATION PLATFORM AS A SERVICE (iPaaS)  "A MARKETER'S GUIDE : " INTEGRATION PLATFORM AS A SERVICE (iPaaS)  "
A MARKETER'S GUIDE : " INTEGRATION PLATFORM AS A SERVICE (iPaaS) "
 
Роман Кравченко “Blockchain-Powered Internet of Things” {R0boCamp}
Роман Кравченко “Blockchain-Powered Internet of Things” {R0boCamp} Роман Кравченко “Blockchain-Powered Internet of Things” {R0boCamp}
Роман Кравченко “Blockchain-Powered Internet of Things” {R0boCamp}
 

Viewers also liked

Viewers also liked (10)

Overcoming Obstacles to Success with Microservices
Overcoming Obstacles to Success with MicroservicesOvercoming Obstacles to Success with Microservices
Overcoming Obstacles to Success with Microservices
 
Apache Camel & The Art of Entreprise Integration
Apache Camel & The Art of Entreprise IntegrationApache Camel & The Art of Entreprise Integration
Apache Camel & The Art of Entreprise Integration
 
Moving to microservices – a technology and organisation transformational journey
Moving to microservices – a technology and organisation transformational journeyMoving to microservices – a technology and organisation transformational journey
Moving to microservices – a technology and organisation transformational journey
 
Delivering with Microservices - How to Iterate Towards Sophistication
Delivering with Microservices - How to Iterate Towards SophisticationDelivering with Microservices - How to Iterate Towards Sophistication
Delivering with Microservices - How to Iterate Towards Sophistication
 
How to Choose the Right Technology, Framework or Tool to Build Microservices
How to Choose the Right Technology, Framework or Tool to Build MicroservicesHow to Choose the Right Technology, Framework or Tool to Build Microservices
How to Choose the Right Technology, Framework or Tool to Build Microservices
 
Big Data en Azure: Azure Data Lake
Big Data en Azure: Azure Data LakeBig Data en Azure: Azure Data Lake
Big Data en Azure: Azure Data Lake
 
Microservices Technology Stack
Microservices Technology StackMicroservices Technology Stack
Microservices Technology Stack
 
Microservices = Death of the Enterprise Service Bus (ESB)?
Microservices = Death of the Enterprise Service Bus (ESB)?Microservices = Death of the Enterprise Service Bus (ESB)?
Microservices = Death of the Enterprise Service Bus (ESB)?
 
Dockercon State of the Art in Microservices
Dockercon State of the Art in MicroservicesDockercon State of the Art in Microservices
Dockercon State of the Art in Microservices
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
 

Similar to From no services to Microservices

Navigator Systems ltd HireTrack NX questions
Navigator Systems ltd   HireTrack NX questionsNavigator Systems ltd   HireTrack NX questions
Navigator Systems ltd HireTrack NX questions
David Rose
 
How to Migrate Applications Off a Mainframe
How to Migrate Applications Off a MainframeHow to Migrate Applications Off a Mainframe
How to Migrate Applications Off a Mainframe
VMware Tanzu
 
Fostering innovation through agile Government ICT
Fostering innovation through agile Government ICTFostering innovation through agile Government ICT
Fostering innovation through agile Government ICT
syeats
 
cloud session uklug
cloud session uklugcloud session uklug
cloud session uklug
dominion
 

Similar to From no services to Microservices (20)

QCon 2015 - Microservices Track Notes
QCon 2015 - Microservices Track Notes QCon 2015 - Microservices Track Notes
QCon 2015 - Microservices Track Notes
 
Think Big - Build Small
Think Big - Build SmallThink Big - Build Small
Think Big - Build Small
 
Navigator Systems ltd HireTrack NX questions
Navigator Systems ltd   HireTrack NX questionsNavigator Systems ltd   HireTrack NX questions
Navigator Systems ltd HireTrack NX questions
 
Configuration Management is Old and Boring
Configuration Management is Old and BoringConfiguration Management is Old and Boring
Configuration Management is Old and Boring
 
From Monoliths to Services: Grafually paying your Technical Debt
From Monoliths to Services: Grafually paying your Technical DebtFrom Monoliths to Services: Grafually paying your Technical Debt
From Monoliths to Services: Grafually paying your Technical Debt
 
How to Migrate Applications Off a Mainframe
How to Migrate Applications Off a MainframeHow to Migrate Applications Off a Mainframe
How to Migrate Applications Off a Mainframe
 
What serverless means for enterprise apps
What serverless means for enterprise appsWhat serverless means for enterprise apps
What serverless means for enterprise apps
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
 
Interop Las Vegas Cloud Connect Summit 2014 - Software Defined Data Center
Interop Las Vegas Cloud Connect Summit 2014 - Software Defined Data CenterInterop Las Vegas Cloud Connect Summit 2014 - Software Defined Data Center
Interop Las Vegas Cloud Connect Summit 2014 - Software Defined Data Center
 
microservices-is-it-the-holy-grail-a-perspective.pdf
microservices-is-it-the-holy-grail-a-perspective.pdfmicroservices-is-it-the-holy-grail-a-perspective.pdf
microservices-is-it-the-holy-grail-a-perspective.pdf
 
We are drowning in complexity—can we do better?
We are drowning in complexity—can we do better?We are drowning in complexity—can we do better?
We are drowning in complexity—can we do better?
 
Introduction to the Typesafe Reactive Platform
Introduction to the Typesafe Reactive PlatformIntroduction to the Typesafe Reactive Platform
Introduction to the Typesafe Reactive Platform
 
Building a [micro]services platform on AWS
Building a [micro]services platform on AWSBuilding a [micro]services platform on AWS
Building a [micro]services platform on AWS
 
Fostering innovation through agile Government ICT
Fostering innovation through agile Government ICTFostering innovation through agile Government ICT
Fostering innovation through agile Government ICT
 
2 speed it powered by microsoft azure
2 speed it powered by microsoft azure2 speed it powered by microsoft azure
2 speed it powered by microsoft azure
 
Top 5 Java Performance Metrics, Tips & Tricks
Top 5 Java Performance Metrics, Tips & TricksTop 5 Java Performance Metrics, Tips & Tricks
Top 5 Java Performance Metrics, Tips & Tricks
 
Synchronicity of a distributed financial system
Synchronicity of a distributed financial systemSynchronicity of a distributed financial system
Synchronicity of a distributed financial system
 
cloud session uklug
cloud session uklugcloud session uklug
cloud session uklug
 
The Need of Cloud-Native Application
The Need of Cloud-Native ApplicationThe Need of Cloud-Native Application
The Need of Cloud-Native Application
 
Webinar: iPaaS in the Enterprise - What to Look for in a Cloud Integration Pl...
Webinar: iPaaS in the Enterprise - What to Look for in a Cloud Integration Pl...Webinar: iPaaS in the Enterprise - What to Look for in a Cloud Integration Pl...
Webinar: iPaaS in the Enterprise - What to Look for in a Cloud Integration Pl...
 

Recently uploaded

%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Recently uploaded (20)

%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 

From no services to Microservices

  • 1. From No Services to Microservices A journey of a FinTech application into the cloud, starting as a monolith and growing to MicroServices. Why going functional is so good for finance technology, and how Scala helped us build a better application. João Cavalheiro - e.Near joao.cavalheiro@enear.co
  • 2. Fintech in a Nutshell • Fintech is mostly about using technology to make financial services more efficient. • Fintech companies are in many cases startups, and have the purpose of disrupting existing financial systems. • Popular areas are payments & lending, blockchain and market monitoring and tracking
  • 3. Developing Fintech Software • Complex business models • Data security • Code stability and adaptability • Quality of service (QOS) Your programming language, team skills and toolkit must be able to deal with all the above
  • 4. Avoid • Non-Agile development processes • Growing the team too quickly • Start writing code before you understand the business model
  • 5. Go Functional • Intent over implementation • Immutability - correct code by design • Transparent concurrency • Use conventions and patterns
  • 6. Use Scala(you should) • Focus on easiness of refactoring instead of elite- looking code • Do not abuse implicits! • Part of our team was moving from Java, so..
  • 7. Leverage on Java Ecosystem • Lots of useful Java libraries out there. You can use them in your Scala project • Don’t feel guilty for using OO design in your first days in Scala • All JVM concepts can be applied
  • 8. Why Starting with a Monolith can be Good • Fintech companies sometimes grow really fast • The business model is a moving part • Logical option is to invest time on a carefully designed monolith • It would be simpler to move to microservices later
  • 9. Monolith Design • Logical option is to invest time on a carefully designed monolith
  • 10. Monolith Design • Should be adjusted to business and product requirements • Sometimes is just better to focus initially on your monolith functionality and gradually peel off microservices at the edges • You can also sacrifice your currently architecture and go for a complete system redesign
  • 11. Our Application • Software-as-a-Service • Core micro-finance system • Combines administration, security, accounting, loan portfolio management and deposit tracking • Currently in production with 20 paying customers (MFI banks) and over 400.000 end clients.
  • 12. Initial Tech Stack • Using Scala and Play! framework • PostgresSQL database
  • 13. The Data Model • Data model is event-based, every operation over an account is an event • Repayment schedules are stored in the database, one row per instalment • We also keep track of all non-transaction actions on the system
  • 14. The Hit on The Wall • We reached 200.000 lines of code on our monolith play! Application. • It was getting hard to keep development under control • Bug density was increasing with the product complexity • And we had a few demanding requirements…
  • 15. Business talks • Operations, including transactions, can be backdated and reverted, any moment in time • It is in fact, possible to change the past • We could not rely on a simple snapshotting model. The snapshots in the past could change, and they would affect all the subsequent snapshots as well.
  • 16. Headed for Microservices • Services that are themselves very simple, focusing on doing one thing well • Use different languages/frameworks and tools for each service • Integrate new team members much easier
  • 17. The First Microservice • Our immediate need was to find a dynamic snapshot solution to accommodate transaction backdating and have the updated detailed status of each account, for at least the last 30 days • This could never operate on top of current application stack and database • We had a great candidate for the first microservice
  • 19. CQRS • The concept at the heart of it is to use a different model to create/update information than the model you use to read information • It adds complexity, but we were going to use it only on specific portions of the system • It allowed us to define separate materialised query views that implement the aggregation strategy for account transactions
  • 20. The outcome • The view model It’s eventually consistent, but reports are in most cases statistical, and therefore “almost-real-time” is acceptable • Denormalized = Efficiency lookup • All seemed great!
  • 22. The doubts • Can we share a single database? • How do we manage dependencies? • Multiple code bases, multiple git repos & branching models
  • 23. The Next Service and experience with AKKA HTTP • The need to add document management to our product and to do it with a scalable solution • We needed something lighter than Play! • Spray is no longer actively developed • AKKA-http?
  • 24. AKKA-http • It was a moving target. Api stability was not proven • It doesn’t work right out of the box • Should we fall back to Play?
  • 25. AKKA-http • With Akka-http you can choose and control each component of your solution • Add new components with a smaller risk • Easier to find and fix problems • But, if you are short on time, under pressure, and you don’t know Spray or Akka-http at all, consider Play
  • 26. It worked in DEV… • AKKA-http proved to be a good solution • Microservices were helping • Performance was improved • But, someone was not happy…
  • 27. “… OPS problem now” • Microservices come with operations overhead: • Monitoring • Deployment • Security • Seriously consider to have DEVOPS
  • 28. What we Learned • Moving to microservices is not a silver bullet, and the increased complexity means there are a lot of areas which need to be carefully considered • All in all, microservices are not a free lunch, but in many cases it’s a worthwhile investment • Scala made it easier!