Cloud-native application architecture
The following are key characteristics of the cloud-native application:
- Twelve-Factor applications: A set of patterns for an optimized application to improve application design for speed, safety, and scale.
- Microservices: An architecture pattern. According to this pattern, we create individual and independent services such as deploying these without impacting other business services. It allows each capability to move independently and autonomously, and in turn faster and safer.
- Self-service agile infrastructure: It is related to the cloud platforms and infrastructure that enable development teams to operate at an application and service-abstraction level.
- API-based collaboration: It defines service-to-service interaction between several microservices.
- Antifragility: It is related to responsiveness, which means that as we increase load on the system using sudden traffic or speed and scale, the system improves its ability to respond, increasing safety.
Microservices architecture
Let's look at the following diagram of a monolithic application without the microservices architecture:

Let's divide this monolithic application into separate pieces according to the modules, and create with the microservice architecture. See the following diagram:

Microservice benefits
- Smaller code bases are easy to maintain
- Easy to scale means you can scale individual components
- Technology diversity means you can use mix libraries, frameworks, data storage, and languages
- Fault isolation means component failure should not bring the whole system down
- Better support for smaller, parallel teams
- Independent deployment
- Reduced team size also reduces the overhead associated with keeping a team focused and moving in one direction
Microservice challenges
- Difficulty to achieve strong consistency across services, such as maintaining ACID transactions within multiple processes
- Because of distributed system, it's harder to debug/trace
- Greater need for end-to-end testing
- How applications are developed and deployed
- Communication across services and service-to-service calls
Difficulty? Solution
- How do multiple microservices find each other? Service discovery
- How do we decide which instance of a service to use? Client-side load balancing
- What happens if a particular microservice is not responding? Fault tolerance
- How do we control the access of a microservice, such as providing security and rate limits? Service security
- How do multiple microservices communicate with each other? Messaging
Spring Boot makes for easy development with the microservices:
- You can create numerous services by using Spring Boot
- You can expose resources via
RestController - You can also consume these remote services using
RestTemplate