Overview
This series will demonstrate how to build reactive systems. To accomplish this, we're going to rethink IBM's Stock Trader reference architecture as a reactive system from the ground up.
Objectives
This series will introduce a cloud-native approach to designing mission-critical enterprise systems. To accomplish this, we'll use open source tools that can take advantage of virtually unlimited pools of resources in the cloud to create systems that are responsive, elastic, resilient, and message-driven.
On completion of the series, you should understand the fundamentals of reactive systems development and gain hands-on experience as we work together to implement a reactive systems architecture. This will enable you to create enterprise software that is responsive, scalable, and resilient under all circumstances, including hardware failure, spikes of traffic, and other acts of force majeure.
What is a reactive system?
The term reactive system originally comes from the reactive manifesto, a short set of guiding principles on how to build responsive, scalable, self-healing systems that are cloud-native.
A reactive system has a few specific properties:
- Responsiveness
- Elasticity
- Resilience
- Message-driven
A reactive system can provision resources on demand, such as additional virtual nodes in the cloud, and then spread the workload across those resources. This gives reactive systems the ability to scale out in real time to deal with fluctuating demand. A reactive system can also scale back in once demand subsides, an important but often overlooked trait of elastic systems. This helps you to keep your operational costs reasonable. Gone are they days when you need to over-provision resources in order to accommodate your heaviest loads. A reactive system is dynamic, able to adapt to real-time usage conditions, such as a spike of traffic from our users, to operational conditions, such as additional server nodes being added or removed from cloud infrastructure.
Using open source technologies such as Lagom and Akka, it is possible to build systems that tolerate failure of nodes, and can migrate state to surviving nodes and redistribute the workload in near real-time. This fault tolerance is highly valuable when deploying systems to cloud infrastructure and managing computing resources using Kubernetes. Compare this to complex session replication and failover mechanisms in heritage environments, and the advantages of reactive systems become compelling.
Developers working with cloud infrastructure are already creating distributed systems. CPUs have multiple cores, a server in a cluster has multiple CPUs, a cluster has multiple servers, and a data center will host many clusters of servers. Not only do we need to take full advantage of these resources, but we must learn techniques to leverage these resources in a highly distributed, highly concurrent environment.
The cloud gives us the means to create a virtually infinite pool of resources. Reactive systems development enables us to fully leverage those resources.
Prerequisite knowledge
This series is a hands-on, step-by-step journey to build the classical IBM Stock Trader system in a reactive style, with a focus on demonstrating code patterns common in reactive systems development.
We assume familiarity with domain-driven design (DDD) and event storming. Both of these techniques are fundamental to modeling and understanding reactive systems. There are a few resources that we highly recommend completing for readers without previous experience in domain-driven design and event storming:
- Domain-driven design is covered in the "Reactive Architecture: Domain Driven Design" on Cognitive Class. This is a comprehensive but accessible introduction to DDD, which this series will build upon.
- Event storming may not be familiar, so we will introduce it in this series. However, for a gentle introduction, this blog outlines event storming in under 10 minutes.
In addition to the above, optional learnings include the "Lightbend Reactive Architecture: Foundations" learning path on Cognitive Class, which provides part of the necessary background to follow along with the more technical details of these tutorials. As we move deeper into the implementation over the course of this series, readers may also want to complete "Lightbend Reactive Architecture: Advanced," which covers some of the specific techniques in later units, such as sharding, sagas, message brokers, and CQRS (Command Query Responsibility Segregation).
Units
The following items make up this series:
- Tutorial
Reactive in practice, Unit 1: Event storming the stock trader domain
Define the building blocks of a reactive system, starting with event storming.
- Tutorial
Reactive in practice, Unit 2: Prototype the UI and UI integration patterns
Prototype interfaces for Reactive Stock Trader.
- Tutorial
Reactive in practice, Unit 3: Translate the domain model to service APIs
Start development of a reactive microservice.
- Tutorial
Reactive in practice, Unit 4: Concurrency, parallelism, and asynchrony
Understand the fundamentals of asynchronous programming principles.
- Tutorial
Reactive in practice, Unit 5: Event sourcing
Understand what the PortfolioEntity is and how to implement your own PersistentEntity in Lagom, leading into event sourcing.
- Tutorial
Reactive in practice, Unit 6: CQRS, Part 1 - Write side
Learn about a CQRS-based system, which allows separate models for reads and writes, enabling individual optimization for each side.
- Tutorial
Reactive in practice, Unit 7: CQRS, Part 2 - ReadSideProcessor for queries and views
Learn how to query an event-sourced and CQRS-based system, and how to move processing into its own asynchronous boundary.
- Tutorial
Reactive in practice, Unit 8: CQRS, Part 3 - ReadSideProcessor for transactions
Explore how to manage a long-running transaction flow with multiple steps, processing wire transfer events as an example.
- Tutorial
Reactive in practice, Unit 9: Reactive integration patterns
Learn the basics of publish-subscribe in Lagom as an alternative to complex point-to-point, database, and shared library integration.
- Tutorial
Reactive in practice, Unit 10: Streaming data
Learn fundamental concepts of streaming data, and understand the deeper levels of engineering within a truly reactive system.
- Tutorial
Reactive in practice, Unit 11: Deploy to Kubernetes
See how modern container management platforms, like Kubernetes, make it easier to deploy a reactive system to a production environment.
- Tutorial
Reactive in practice, Unit 12: Conclusion and summary
Review the topics covered in this series, with a complete overview of the components of Reactive Stock Trader's final architecture.