Slide 1

Slide 1 text

Experiences on building a modular reactive architecture CIR-BCC

Slide 2

Slide 2 text

About Me @anestodta [email protected] https://www.linkedin.com/in/anesto-del-toro • Head of Production, DATYS VC • MSc Computer Sciences • Wearing multiple hats oTechnical Lead oArchitecture oSoftware Development (mostly backend) oProject Management oBusiness Analysis oLean-Agile enthusiast oEager learner • 17 years of experience o~6 Researcher at UCLV (BE, PR & CV) Anesto del Toro Almenares

Slide 3

Slide 3 text

This talk and Devops…

Slide 4

Slide 4 text

•CIR-BCC: Scope •Building the solution • Challenges • Architecture/design decisions • Dev/IT support services •Conclusions Outline

Slide 5

Slide 5 text

SCOPE

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

What is the Risk Information Center (CIR)? Free public service offered by the Superintendence of the Central Bank of Cuba (BCC). Directed to the National Banking and Financial System and to legal and natural persons who have credit from the country's financial institutions and operate current account.

Slide 8

Slide 8 text

What is the objective? Provide information to: -financial institutions, in order to contribute to the mitigation of their risks -debtors about their credit situation -clients on the measures applied in their accounts for breaches of the banking rules.

Slide 9

Slide 9 text

Software Delivery System Achieve faster development and deployment cycles of quality products, in a reliable and sustainable way Enterprise Agility

Slide 10

Slide 10 text

Communication matters…

Slide 11

Slide 11 text

(c4 diagrams)

Slide 12

Slide 12 text

•What are we building? •Who is using it? (users, actors, roles, personas, etc.) •How does it fit to the existing IT environment? Context diagram

Slide 13

Slide 13 text

Risk Information Center - BCC Supervisor Financial Institution Legal person Admin [sign-in user + psw] Users Accesses Apps authorizations Legislations Natural person Credit info Operational info Exposure Level Risk concentration Credit info Operational info Credit info Operational info Credit info Operational info Ext. App 1 … Ext App N [sign-in AppId + token] Analysis requests SIB (legacy system)

Slide 14

Slide 14 text

SIB (legacy system) Risk Information Center - BCC Supervisor Financial Institution Legal person Admin [sign-in user + psw] Users Accesses Apps authorizations Legislations Natural person Credit info Operational info Exposure Level Risk concentration Credit info Operational info Credit info Operational info Credit info Operational info Ext. App 1 … Ext App N [sign-in AppId + token] Analysis requests NTP SMTP Monitoring Register events of interest Email responses Time synch

Slide 15

Slide 15 text

What are the high-level technology decisions?

Slide 16

Slide 16 text

Challenges

Slide 17

Slide 17 text

CONCURRENT ACCESS

Slide 18

Slide 18 text

DEPLOYMENT FLEXIBILITY

Slide 19

Slide 19 text

LEGACY SYSTEM INTEGRATION Data lifecycle

Slide 20

Slide 20 text

Decoupling frontend and backend teams

Slide 21

Slide 21 text

Frontend WebApp Backend Services • Non blocking / Async • Event Sourcing (ES) • Command Query Responsibility Segregation (CQRS) • SPA Stack Clear API contract

Slide 22

Slide 22 text

STACK SELECTION

Slide 23

Slide 23 text

Frontend stack

Slide 24

Slide 24 text

Backend stack

Slide 25

Slide 25 text

Backend stack • Seamless JAVA interop • Type inference • Concurrency and distribution • Traits • Pattern matching • High-order functions • Design patterns

Slide 26

Slide 26 text

Backend stack • MVC Web development framework • Stateless, asynchronous and non- blocking • Deliver all the benefits of RS, including high degree of responsiveness, elasticity and resiliency • Hot reloading, interoperability with DI frameworks, modularity and extensibility,..

Slide 27

Slide 27 text

Backend stack Toolkit for building highly concurrent, distributed, and resilient message-driven applications for Java and Scala • Simpler Concurrent & Distributed Systems • Resilient by Design • High Performance • Elastic & Decentralized • Reactive Streaming Data

Slide 28

Slide 28 text

Supporting services • CVS • Dependencies repository • Docker repository • Continuous Integration Automation scripts • build.sbt • Testing • Code metrics, Check style • gitlab-ci.yml

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

- Reactive stores - Kafka (durable message bus…) - net.cakesolutions.scala-kafka-client - net.cakesolutions.scala-kafka-client-akka Storage services - Reactive DB drivers and tools (Scala) - reactive-mongodb - rediscala - play-ws

Slide 31

Slide 31 text

docker-compose.yml Sandboxing

Slide 32

Slide 32 text

Modularity & Composability

Slide 33

Slide 33 text

Modularity

Slide 34

Slide 34 text

build.sbt mainApp [Play] JWT Auth, Users Management, Credit and Operational Analysis Modularity

Slide 35

Slide 35 text

mainApp/application.conf Modularity

Slide 36

Slide 36 text

d2AppCOInfo [Play] Detailed Credit and Operational Info d2AppCore [Play] Authentication (JWT), User management, Customers, Roles, 3rd party Apps, d2AppRCEL [Play] Exposure Level Risk Concentration Gross Loss Stockholders' Equity API Gateway [NGinX ] build.sbt Modularity

Slide 37

Slide 37 text

.../d2AppRCEL/application.conf .../d2AppCore/application.conf ... Modularity

Slide 38

Slide 38 text

Messaging System [Kafka] NoSQL Data Store [MongoDB 3.4.x] Cache Data Store [Redis 3.2.x] d2AppCOInfo [Play] Detailed Credit and Operational Info d2AppCore [Play] Authentication (JWT), User management, Customers, Roles, 3rd party Apps, d2AppRCEL [Play] Exposure Level Risk Concentration Gross Loss Stockholders' Equity API Gateway [NGinX ] Modularity

Slide 39

Slide 39 text

Messaging System [Kafka] NoSQL Data Store [MongoDB 3.4.x] Cache Data Store [Redis 3.2.x] d2AppCOInfo [Play] Detailed Credit and Operational Info d2AppCore [Play] Authentication (JWT), User management, Customers, Roles, 3rd party Apps, d2AppRCEL [Play] Exposure Level Risk Concentration Gross Loss Stockholders' Equity API Gateway [NGinX ] NoSQL Data Store [MongoDB 3.4.x] Cache Data Store [Redis 3.2.x] NoSQL Data Store [MongoDB 3.4.x] Cache Data Store [Redis 3.2.x] Modularity

Slide 40

Slide 40 text

Deploy project

Slide 41

Slide 41 text

•Modularity / App Composability •Horizontal scalability •Deployment flexibility Different scalability levels per App, including data services ad-hoc, incremental Small apps working coordinately (Bounded Contexts) Apps evolving in parallel (different teams) Benefits

Slide 42

Slide 42 text

The ability to behave correctly under load and to scale on demand can not be a last time though

Slide 43

Slide 43 text

Legacy system integration

Slide 44

Slide 44 text

SIB (legacy system) Ingestion Aggregation Query/Retrieval Event Journal Snapshots Topics subscription Topics publisher Read Model

Slide 45

Slide 45 text

read model aggr-apps SIB Credit Info AggApp Risk Concentration AggApp Exposure Level AggApp M300Event SIB Ingester M301Event M910Event M918Event MCMEvent … M920Event topics web-app mainApp [Play] JWT Auth, Users Management, Credit and Operational Analysis

Slide 46

Slide 46 text

M300Event SIB Ingester M301Event M910Event M918Event MCMEvent … M920Event SIB topics Risk Concentration AggApp Credit Info AggApp Exposure Level AggApp aggr-apps read model web-app d2AppRCEL [Play] Exposure Level Risk Concentration Gross Loss Stockholders' Equity d2AppCOInfo [Play] Detailed Credit and Operational Info

Slide 47

Slide 47 text

- Event Sourcing (ES) ES-CQRS - Command Query Responsibility Segregation (CQRS)

Slide 48

Slide 48 text

"com.hootsuite" %% "akka-persistence-redis" % 0.6.0 "com.github.scullxbones" %% "akka-persistence-mongo-rxmongo" % 1.4.1 Persistent Actor

Slide 49

Slide 49 text

SIB (legacy system) Ingestion Aggregation Query/Retrieval Data lifecycle Change Data Capture (CDC) to the rescue… Extracting any inserts, updates, and deletes into a stream of data change events

Slide 50

Slide 50 text

• What is the shape / general appearance of the system? • How the main responsibilities are distributed in the system? • How do components communicate? Containers diagram

Slide 51

Slide 51 text

[https, WS] SIB [External System] Web browser Frontend / Proxy [NGinX ] [https] Risk Information Center - BCC

Slide 52

Slide 52 text

[https, WS] SIB [External System] Web Application [Play, Stateless] JWT Auth, Management of Users & Legislations, Credit and Operational Analysis Rest Services. UI (SPA) [NGinX] API Gateway [NGinX ] Authentication (JWT), Request throttling, Load balancing. Web browser Frontend / Proxy [NGinX ] [https]

Slide 53

Slide 53 text

[https, WS] SIB [External System] Web Application [Play, Stateless] JWT Auth, Management of Users & Legislations, Credit and Operational Analysis Rest Services. UI (SPA) [NGinX] NoSQL Data Store [MongoDB 3.4.x] Store CI preaggregated docs (CQRS) Cache Data Store [Redis 3.2.x] Caches IFs, Entities, NE, CB, CC, pre- computes, etc. API Gateway [NGinX ] Authentication (JWT), Request throttling, Load balancing. Web browser Frontend / Proxy [NGinX ] [https]

Slide 54

Slide 54 text

[https, WS] SIB [External System] Content Updater [Standalone, Akka] ES, Updates Models, Customers, Financial Institutions, etc. Messaging System [Kafka] Durable message bus, integration, etc. Publish messages [Avro] Web Application [Play, Stateless] JWT Auth, Management of Users & Legislations, Credit and Operational Analysis Rest Services. UI (SPA) [NGinX] Reads and write messages [Avro] NoSQL Data Store [MongoDB 3.4.x] Store CI preaggregated docs (CQRS) Cache Data Store [Redis 3.2.x] Caches IFs, Entities, NE, CB, CC, pre- computes, etc. API Gateway [NGinX ] Authentication (JWT), Request throttling, Load balancing. Web browser Frontend / Proxy [NGinX ] [https]

Slide 55

Slide 55 text

[https, WS] SIB [External System] Content Updater [Standalone, Akka] ES, Updates Models, Customers, Financial Institutions, etc. Messaging System [Kafka] Durable message bus, integration, etc. Publish messages [Avro] Web Application [Play, Stateless] JWT Auth, Management of Users & Legislations, Credit and Operational Analysis Rest Services. UI (SPA) [NGinX] Reads and write messages [Avro] NoSQL Data Store [MongoDB 3.4.x] Store CI preaggregated docs (CQRS) Cache Data Store [Redis 3.2.x] Caches IFs, Entities, NE, CB, CC, pre- computes, etc. API Gateway [NGinX ] Authentication (JWT), Request throttling, Load balancing. Web browser Changes Tracking [SQLServer feature] Track in SQL Server changes to records. Frontend / Proxy [NGinX ] [https]

Slide 56

Slide 56 text

[https, WS] SIB [External System] Content Updater [Standalone, Akka] ES, Updates Models, Customers, Financial Institutions, etc. Messaging System [Kafka] Durable message bus, integration, etc. Publish messages [Avro] Web Application [Play, Stateless] JWT Auth, Management of Users & Legislations, Credit and Operational Analysis Rest Services. UI (SPA) [NGinX] Reads and write messages [Avro] NoSQL Data Store [MongoDB 3.4.x] Store CI preaggregated docs (CQRS) Cache Data Store [Redis 3.2.x] Caches IFs, Entities, NE, CB, CC, pre- computes, etc. API Gateway [NGinX ] Authentication (JWT), Request throttling, Load balancing. Web browser Changes Tracking [SQLServer feature] Track in SQL Server changes to records. Frontend / Proxy [NGinX ] [https] Schema Registry

Slide 57

Slide 57 text

[https, WS] SIB [External System] Content Updater [Standalone, Akka] ES, Updates Models, Customers, Financial Institutions, etc. Messaging System [Kafka] Durable message bus, integration, etc. Publish messages [Avro] Web Application [Play, Stateless] JWT Auth, Management of Users & Legislations, Credit and Operational Analysis Rest Services. UI (SPA) [NGinX] Reads and write messages [Avro] NoSQL Data Store [MongoDB 3.4.x] Store CI preaggregated docs (CQRS) Cache Data Store [Redis 3.2.x] Caches IFs, Entities, NE, CB, CC, pre- computes, etc. API Gateway [NGinX ] Authentication (JWT), Request throttling, Load balancing. Web browser Changes Tracking [SQLServer feature] Track in SQL Server changes to records. Frontend / Proxy [NGinX ] [https] Schema Registry vcMon vcAlert [External System] [External System] Gets metrics from [Http] Metrics Collector [cAdvisor] Gathers metrics from Hosts and Containers Metrics Engine [Prometheus] Stores and serves aggregated metrics and emits alerts

Slide 58

Slide 58 text

What do we need?

Slide 59

Slide 59 text

Production Staging Security / NFR Minutes Weeks Each cycle targets a different concern Feedback loops UAT Increment deploy Code Reviews Integration tests Acceptance tests Unit Testing

Slide 60

Slide 60 text

Infrastructure supporting services

Slide 61

Slide 61 text

Bring Ops tools closer to Developers

Slide 62

Slide 62 text

Load and Performance tests automation

Slide 63

Slide 63 text

UAT Deploy Production like Deploy Unit tests Integration tests Code & Vulnerabilities Analysis Acceptance tests Load, Smoke, Security tests … Exploratory Production deploy Deployment pipeline Up to 8 deploys/releases* per day

Slide 64

Slide 64 text

Increment Review Increment Review User Acceptance Testing User Acceptance Testing Documentation Documentation Development & Operations Development & Operations Management & Planning Management & Planning Knowledge sharing/retention Knowledge sharing/retention Automation Self-services Automation Self-services Code repository Code repository Platform as a Service Platform as a Service Artifacts and dependencies repositories Artifacts and dependencies repositories Stakeholders Stakeholders Internet Production System

Slide 65

Slide 65 text

No content

Slide 66

Slide 66 text

No content

Slide 67

Slide 67 text

• Communication/collaboration amplified • Shared mindset/vision • Automation of supporting services • Results are not the solely point, but the development of People and Systems that allows us to achieve the results we expect Conclusions

Slide 68

Slide 68 text

[email protected] @anestodta https://www.linkedin.com/in/anesto-del-toro Anesto del Toro Almenares Experiences on building a modular reactive architecture