In Chapter 4, Evolution toward Microservices and Cloud-Native Applications, we discussed the problems with monolithic applications and how architectures evolved toward microservices. However, microservices have their own sets of challenges:
- Organizations adopting microservice architectures also need to make challenging decisions around the consistency of microservices without affecting the innovation capabilities of the microservice teams.
- Smaller applications mean more builds, releases, and deployments. This is usually addressed using more automation.
- Microservice architectures are built based on a large number of smaller, fine-grained services. There are challenges associated with managing configuration and availability of these services.
- Debugging issues becomes more difficult because of the distributed nature of applications.
To reap maximum benefits from microservice architectures, microservices should be Cloud-Native--easily deployable on the Cloud. In Chapter 4, Evolution toward Microservices and Cloud-Native Applications, we discussed the characteristics of Twelve-Factor Apps--patterns that are typically considered good practices in Cloud-Native applications.
Spring Cloud aims to provide solutions to some commonly encountered patterns when building systems on the Cloud. Some of the important features include the following:
- Solutions to manage distributed microservice configuration
- Service registration and discovery using Name servers
- Load balancing across multiple instances of microservices
- More fault-tolerant services using circuit breakers
- API Gateways for aggregation, routing, and caching
- Distributed tracing across microservices
It is important to understand that Spring Cloud is not a single project. It is a group of subprojects aimed at solving the problems associated with applications deployed on the Cloud.
Some important Spring Cloud subprojects are as follows:
- Spring Cloud Config: Enables centralized external configuration across different microservices across different environments.
- Spring Cloud Netflix: Netflix is one of the early adopters of microservice architecture. A number of internal Netflix projects were open sourced under the umbrella of Spring Cloud Netflix. Examples include Eureka, Hystrix, and Zuul.
- Spring Cloud Bus: Makes it easier to build the integration of microservices with a lightweight message broker.
- Spring Cloud Sleuth: Along with Zipkin, this provides distributed tracing solutions.
- Spring Cloud Data Flow: Provides capabilities for building orchestration around microservice applications. Provides a DSL, GUI, and REST API.
- Spring Cloud Stream: Provides a simple declarative framework to integrate Spring-based (and Spring Boot)-based applications with message brokers such as Apache Kafka or RabbitMQ.
A few things are common to all projects under the Spring Cloud umbrella:
- They solve some of the common problems with developing applications on the Cloud
- They provide great integration with Spring Boot
- They are typically configured with simple annotations
- They make extensive use of auto-configuration