Skip to content

[Draft] Ebook cloud native architecture for review #42010

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
161 commits
Select commit Hold shift + click to select a range
0111256
adding chapter 2
May 13, 2024
524db59
updates
May 13, 2024
cc3f16c
fixing navigation
May 13, 2024
39fe185
adding chapter 8 - data patterns
May 13, 2024
85ab723
The directory for all the chapters to be merged into
Jun 2, 2024
7889813
Chapter 10 - Monitoring health for review
Jun 2, 2024
bbd4bfa
Adding resiliency chapter
Jun 3, 2024
3e6287e
Merge branch 'dotnet:main' into ebook-cloud-native-architecture
Jun 3, 2024
44b5f66
Chapter 11 security and identity
Jun 3, 2024
6895eab
Merge branch 'dotnet:main' into ebook-cloud-native-architecture
Jun 4, 2024
14995e8
Adding chapter 13 API gateways
Jun 4, 2024
1412c56
Improving content
Jun 5, 2024
98d3f11
Improving content
Jun 5, 2024
b777a82
Improving content
Jun 5, 2024
bc01a3c
Improving content
Jun 5, 2024
d7448e1
Merge branch 'dotnet:main' into ebook-cloud-native-architecture
Jun 6, 2024
69e030f
Adding chapter 1
Jun 6, 2024
5b567b2
Merge branch 'dotnet:main' into ebook-cloud-native-architecture
Jun 6, 2024
2c998a3
Adding chapter 6
Jun 6, 2024
74d4884
Adding chatper 12 testing apps
Jun 6, 2024
dff68f1
adding chapter 7
Jun 10, 2024
410c48c
pets and cattle update
Jun 10, 2024
c9f0ec8
updated eshop link
Jun 10, 2024
6c51bf7
review updates
Jun 11, 2024
d0c23a2
adding chapter 3 ready for review
Jun 12, 2024
a04efc3
review updates
Jun 12, 2024
2fd2a35
review updates
Jun 12, 2024
d543f1d
adding chapter 5
Jun 19, 2024
2816d69
Updated to reference new eshop
Jun 21, 2024
b9989c5
updated eshop references
Jun 21, 2024
f901e42
ch6 - added link to eShop presentation
Jun 21, 2024
9f46f75
ch8 Updated eShop references
Jun 21, 2024
795c206
ch12 - updated eshop references
Jun 21, 2024
feef552
Adding branch for ebook
Jun 24, 2024
5b365b6
Merge pull request #1 from PhilStollery/chpt1-introduction-could-nati…
Jun 24, 2024
f7cae37
Merge pull request #2 from PhilStollery/chpt2-intro-containers
Jun 24, 2024
c2e13bf
Merge pull request #3 from PhilStollery/chpt3-introduction-dot-net-as…
Jun 24, 2024
62a02a2
Merge pull request #4 from PhilStollery/chpt-5-communication-patterns
Jun 24, 2024
e0da999
Merge pull request #5 from PhilStollery/chtp6-service-to-service-comm…
Jun 24, 2024
2c2a566
Merge pull request #6 from PhilStollery/chpt7-event-based-communicati…
Jun 24, 2024
b5cd811
Merge pull request #7 from PhilStollery/chpt-8-data-patterns
Jun 24, 2024
3544256
Merge pull request #8 from PhilStollery/chpt9-cloud-native-resiliency
Jun 24, 2024
e931398
Merge pull request #9 from PhilStollery/chpt10-monitoring-health
Jun 24, 2024
3860388
Merge pull request #10 from PhilStollery/chpt11-security-identity
Jun 24, 2024
5982eaa
Merge pull request #11 from PhilStollery/chtp12-testing-distributed-apps
Jun 24, 2024
adf0396
Merge pull request #12 from PhilStollery/chpt13-api-gateway
Jun 24, 2024
cbcc903
adding chapter 4
Jun 25, 2024
78ee041
Update orchestration.md
Jun 25, 2024
2fd30a8
Update service-discovery.md
Jun 25, 2024
6a16148
Update front-end-client-communication.md
Jun 25, 2024
8d5e335
Update application-resiliency-patterns.md
Jun 25, 2024
eed79b8
Update application-resiliency-patterns.md
Jun 25, 2024
58cf0f0
Add files via upload
Jun 25, 2024
5614893
Delete docs/architecture/distributed-cloud-native-apps-containers/dep…
Jun 25, 2024
399a5b8
Delete docs/architecture/distributed-cloud-native-apps-containers/dep…
Jun 25, 2024
e80933f
Delete docs/architecture/distributed-cloud-native-apps-containers/dev…
Jun 25, 2024
81af138
Delete docs/architecture/distributed-cloud-native-apps-containers/dis…
Jun 25, 2024
6f095a9
Delete docs/architecture/distributed-cloud-native-apps-containers/dot…
Jun 25, 2024
08a301d
Delete docs/architecture/distributed-cloud-native-apps-containers/how…
Jun 25, 2024
53a35b1
Delete docs/architecture/distributed-cloud-native-apps-containers/med…
Jun 25, 2024
e6f1ef5
upload of chapter 14
Jun 25, 2024
c306a4d
new update of chapter 14
Jun 25, 2024
1bd0e3f
Update graphics
Jun 27, 2024
a4185aa
image refresh
Jun 27, 2024
0f77fbc
Graphics refresh
Jun 28, 2024
08643c3
graphics fix
Jun 28, 2024
defe819
Graphics update - but cant do anymore
Jun 28, 2024
b4bcc87
Not all graphics updated
Jun 28, 2024
7be1be0
graphic refresh - some missing
Jun 28, 2024
12e4858
Failed to update graphics - also code needs updating
Jun 28, 2024
a99fcf8
Failed to update graphics
Jun 28, 2024
6a6e059
Powerpoint for graphic creation
Jun 28, 2024
12b6731
Updated TODO
Jul 4, 2024
1792e8b
Merge branch 'chpt1-introduction-could-native-dev' of https://github.…
Jul 4, 2024
cda4bb0
Small updates and corrections
alistairmatthews Jul 10, 2024
efb1708
Added a section on Aspire and made corrections.
alistairmatthews Jul 10, 2024
1213733
Initial corrections
alistairmatthews Jul 11, 2024
689bec0
Aspire communications section added.
alistairmatthews Jul 16, 2024
3e42dfd
Added info about .NET Aspire and made other corrections
alistairmatthews Jul 17, 2024
ab73371
Style updated and .NET Azure added
alistairmatthews Jul 22, 2024
2528422
More Aspire additions
alistairmatthews Jul 24, 2024
91844fe
Text revised for consistency with other modules.
alistairmatthews Jul 25, 2024
0b65aa2
Text reviewed for consistency with other modules.
alistairmatthews Jul 25, 2024
0d7a4a0
Minor revisions in style
alistairmatthews Jul 25, 2024
54dcbca
Style improvements
alistairmatthews Jul 26, 2024
2a181e9
Style corrections
alistairmatthews Jul 26, 2024
27430ff
Text revised for consistency with other chapters
alistairmatthews Jul 30, 2024
7c0f3d2
Aspire discussions added and other corrections.
alistairmatthews Jul 31, 2024
3630137
Merge pull request #26 from GeoffAllix/chpt-14-deploying-distributed-…
Aug 2, 2024
5a56009
Merge pull request #25 from GeoffAllix/chpt4-architecting-distributed…
Aug 2, 2024
06e1f96
Merge pull request #24 from GeoffAllix/chpt13-api-gateway
Aug 2, 2024
b7226dc
Merge pull request #23 from GeoffAllix/chtp12-testing-distributed-apps
Aug 2, 2024
04cc7e6
Merge pull request #22 from GeoffAllix/chpt11-security-identity
Aug 2, 2024
43670d4
Merge pull request #21 from GeoffAllix/chpt10-monitoring-health
Aug 2, 2024
fb79e00
Merge pull request #20 from GeoffAllix/chpt9-cloud-native-resiliency
Aug 2, 2024
60d1906
Merge pull request #19 from GeoffAllix/chpt-8-data-patterns
Aug 2, 2024
9889604
Merge pull request #18 from GeoffAllix/chpt7-event-based-communicatio…
Aug 2, 2024
30cc28e
Merge pull request #17 from GeoffAllix/chtp6-service-to-service-commu…
Aug 2, 2024
87b3b9f
Merge pull request #16 from GeoffAllix/chpt-5-communication-patterns
Aug 2, 2024
e6cc71f
Merge pull request #15 from GeoffAllix/chpt3-introduction-dot-net-aspire
Aug 2, 2024
2769c20
Merge pull request #14 from GeoffAllix/chpt2-intro-containers
Aug 2, 2024
3083709
Merge pull request #13 from GeoffAllix/chpt1-introduction-could-nativ…
Aug 2, 2024
d06c1dd
Revised text for consistency with other modules and made corrections.
alistairmatthews Aug 13, 2024
181e68a
Removed TODO entries and made minor corrections.
alistairmatthews Aug 14, 2024
53ec403
Text revised for consistency and other corrections.
alistairmatthews Aug 15, 2024
f2b7835
Text corrected for style consistency and grammar.
alistairmatthews Aug 16, 2024
a4ca059
Aspire info added and small corrections.
alistairmatthews Aug 19, 2024
5a16eaf
Revised text for consistency.
alistairmatthews Aug 19, 2024
647caaf
Aspire info added and style corrections for consistency
alistairmatthews Aug 19, 2024
a58e5ff
Revised for consistency and other corrections.
alistairmatthews Aug 21, 2024
d834f4e
Modified images to reflect Aspire colours
alistairmatthews Aug 21, 2024
38f120d
Removed unused graphic
alistairmatthews Aug 22, 2024
a636cc3
Updated graphics to reflect Aspire branding
alistairmatthews Aug 23, 2024
74bd6e9
Frontend communications removed because it duplicates chapter 13
alistairmatthews Aug 27, 2024
ebc8b15
One link corrected
alistairmatthews Aug 27, 2024
35164c7
Graphics modified to reflect Aspire branding
alistairmatthews Aug 27, 2024
eeec306
Removed a TODO comment.
alistairmatthews Aug 27, 2024
e4a96b3
Modified graphics to reflect Aspire colours
alistairmatthews Aug 27, 2024
24128f1
Updated graphics to reflect Aspire colours
alistairmatthews Aug 27, 2024
c2a67f7
Graphics revised to reflect Aspire branding
alistairmatthews Aug 28, 2024
013e5ad
Graphics updated to reflect Aspire colors
alistairmatthews Sep 2, 2024
856dc02
Revised graphics to reflect Aspire colors
alistairmatthews Sep 3, 2024
c18da1d
Updated graphics to reflect Aspire colors
alistairmatthews Sep 3, 2024
324c43b
Small corrections
alistairmatthews Sep 5, 2024
c088146
Small corrections
alistairmatthews Sep 5, 2024
c161392
Completed links to other chapters
alistairmatthews Sep 6, 2024
b83559d
Chapter links completed.
alistairmatthews Sep 6, 2024
2e99d97
Completed links to other chapters.
alistairmatthews Sep 6, 2024
d540071
Links to other chapters completed.
alistairmatthews Sep 6, 2024
7c98183
Links to other chapters completed.
alistairmatthews Sep 6, 2024
b234ad5
Completed links to other chapters.
alistairmatthews Sep 6, 2024
4df7faa
Completed links to other chapters.
alistairmatthews Sep 6, 2024
060cb20
Completed links to other chapters.
alistairmatthews Sep 6, 2024
d6f0a94
Completed links to other chapters.
alistairmatthews Sep 6, 2024
200c77a
Completed links to other chapters.
alistairmatthews Sep 6, 2024
3e1040e
Completed links to other chapters.
alistairmatthews Sep 6, 2024
34e295f
Completed links to other chapters.
alistairmatthews Sep 6, 2024
a210ff0
Completed links to other chapters.
alistairmatthews Sep 6, 2024
4a455fb
Merge branch 'chpt1-introduction-could-native-dev' into ebook-cloud-n…
alistairmatthews Sep 6, 2024
24d2922
Merge branch 'chpt2-intro-containers' into ebook-cloud-native-archite…
alistairmatthews Sep 6, 2024
be51459
Merge branch 'chpt3-introduction-dot-net-aspire' into ebook-cloud-nat…
alistairmatthews Sep 6, 2024
d5a8ce8
Merge branch 'chpt-5-communication-patterns' into ebook-cloud-native-…
alistairmatthews Sep 6, 2024
c335fa8
Merge branch 'chtp6-service-to-service-communication' into ebook-clou…
alistairmatthews Sep 6, 2024
27180c9
Merge branch 'chpt7-event-based-communication-patterns' into ebook-cl…
alistairmatthews Sep 6, 2024
9509cab
Merge branch 'chpt-8-data-patterns' into ebook-cloud-native-architecture
alistairmatthews Sep 6, 2024
6838bfe
Merge branch 'chpt9-cloud-native-resiliency' into ebook-cloud-native-…
alistairmatthews Sep 6, 2024
1b959f9
Merge branch 'chpt10-monitoring-health' into ebook-cloud-native-archi…
alistairmatthews Sep 6, 2024
4652e85
Merge branch 'chpt11-security-identity' into ebook-cloud-native-archi…
alistairmatthews Sep 6, 2024
5ac2b37
Merge branch 'chtp12-testing-distributed-apps' into ebook-cloud-nativ…
alistairmatthews Sep 6, 2024
a7a5fdd
Merge branch 'chpt13-api-gateway' into ebook-cloud-native-architecture
alistairmatthews Sep 6, 2024
056ed1d
Merge branch 'chpt-14-deploying-distributed-apps' into ebook-cloud-na…
alistairmatthews Sep 6, 2024
596a3b3
Fixing build verifier errors.
alistairmatthews Sep 6, 2024
eae23d8
Fixing markdown lint errors.
alistairmatthews Sep 6, 2024
aeab234
A couple more build verifier fixes.
alistairmatthews Sep 6, 2024
cdd71ea
Updating diagrams PowerPoint.
alistairmatthews Sep 6, 2024
7a399ad
Fixing a broken image link.
alistairmatthews Sep 6, 2024
306adaf
Another trying at fixing a link.
alistairmatthews Sep 6, 2024
8ce3d2f
Another try.
alistairmatthews Sep 6, 2024
34672e2
rename dashboard
jamesmontemagno Sep 25, 2024
1c58d78
Replaced .NET Aspire components with integrations.
alistairmatthews Sep 27, 2024
27998b9
Small fixes for issues raised by @sunnynagavo.
alistairmatthews Sep 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
---
title: Reverse proxies with YARP
description: Architecture for Distributed Cloud-Native Apps with .NET Aspire & Containers | Reverse proxies with YARP
ms.date: 01/13/2021
---
# Reverse proxies with YARP

[!INCLUDE [download-alert](../includes/download-alert.md)]

YARP is a versatile toolkit for building high-performance reverse proxy servers in .NET. Originating from the need within Microsoft to unify various teams' efforts around reverse proxy development, YARP is designed for flexibility and customization, making it suitable for a wide range of deployment scenarios. YARP is now an open-source project, allowing developers to leverage its capabilities for their own projects.

## Key Features of YARP

YARP has several key features that make it a powerful tool for building your reverse proxy servers:

- **Customizable routing**: YARP can direct incoming requests to different backend services based on URL paths, headers, or other attributes.

- **Load balancing**: YARP supports various strategies to distribute load evenly across service instances.

- **Seamless integration with ASP.NET Core middleware**: This allows for custom request/response handling.

- **Health checks**: YARP ensures traffic is only sent to healthy service instances.

- **Session affinity**: YARP can maintain user sessions with specific services when needed.

- **Cross-platform freedom**: YARP works seamlessly across Windows, Linux, and macOS.

- **Protocol prowess**: YARP embraces gRPC, HTTP/2, and WebSockets for modern communication needs.

- **Performance**: YARP is built for speed and efficiency, ensuring low latency and high throughput.

## Getting started with YARP

1. **Installation**: Add YARP to your .NET project using NuGet:

```shell
dotnet add package Yarp.ReverseProxy
```

1. **Basic Configuration**: Configure YARP in your `Startup.cs` file:

```csharp
public void ConfigureServices(IServiceCollection services)
{
services.AddReverseProxy()
.LoadFromConfig(Configuration.GetSection("ReverseProxy"));
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapReverseProxy();
});
}
```

1. **Configuration Files**: Add the YARP configuration to `appsettings.json` for basic configuration:

```json
"ReverseProxy": {
"Routes": {
"route1" : {
"ClusterId": "cluster1",
"Match": {
"Path": "/customer/{**catch-all}"
}
}
},
"Clusters": {
"cluster1": {
"Destinations": {
"destination1": {
"Address": "https://example.com/api/customers/"
}
}
}
}
}
```

1. **Programmatic Configuration**: Customize the configuration dynamically with C# code:

```csharp
builder.Services.AddReverseProxy()
.LoadFromMemory(GetRoutes(), GetClusters());

...


RouteConfig[] GetRoutes()
{
return
[
new RouteConfig()
{
RouteId = "route1",
ClusterId = "cluster1",
Match = new RouteMatch
{
// Path or Hosts are required for each route. This catch-all pattern matches all request paths.
Path = "/customer/{**catch-all}"
}
}
];
}

ClusterConfig[] GetClusters()
{

return
[
new ClusterConfig()
{
ClusterId = "cluster1",
SessionAffinity = new SessionAffinityConfig { Enabled = true, Policy = "Cookie", AffinityKeyName = ".Yarp.ReverseProxy.Affinity" },
Destinations = { "destination1", new DestinationConfig() { Address = "https://example.com/api/customers" }
}
}
];
}
```

## Additional resources

- **Getting Started with YARP** \ <https://microsoft.github.io/reverse-proxy/articles/getting-started.html>

>[!div class="step-by-step"]
>[Previous](gateway-patterns.md)
>[Next](../deploying-distributed-apps/how-deployment-affects-your-architecture.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
title: Different ways to architect distributed applications
description: Architecture for Distributed Cloud-Native Apps with .NET Aspire & Containers | Different ways to architect distributed applications
author:
ms.date: 04/06/2022
---

# Different ways to architect distributed applications

[!INCLUDE [download-alert](../includes/download-alert.md)]

In the ever-evolving landscape of software development, architects and developers are continually seeking efficient ways to design and build distributed applications. Let's explore some of the current architectural approaches. We'll delve into the characteristics, advantages, and challenges of each approach. As we navigate through these different paradigms, we'll discuss crucial aspects such as containerization, data sovereignty, scalability, and communication patterns.

Understanding these architectural styles will allow you to make informed decisions when designing robust, scalable, and maintainable distributed systems in today's cloud-native environment.

## Server-based architecture

![A diagram showing a high level image of server architecture.](media/server-architecture.png)

This is the traditional model where client machines connect to a server for processing and data storage. The server is responsible for all the processing, managing business logic, and data persistence. In this architecture, state and data management is centralized, typically using a single database. This approach simplifies data consistency but the database can become a bottleneck as the system scales. As all data is stored centrally there's no separation of data ownership among different components or services, which leads to tight coupling and makes it difficult to evolve different parts of the system independently.

While not originally designed for containers, monolithic server applications can be containerized. This process provides benefits like consistent environments and easier deployment, but it doesn't address the underlying architectural limitations of a monolithic system. Containerization in this context primarily aids in deployment and environment consistency, rather than in scalability or modularity.

In a server-based architecture, the logical and physical architectures often closely align, with most components residing on a single server or cluster. This simplicity can be an advantage for smaller applications but may limit flexibility as the application grows. The centralized nature of this architecture provides high security as all data is stored in one place, but it also creates a single point of failure and can become a performance bottleneck under high load.

## Modular monoliths

![A diagram showing a modular monolith architecture](media/modular-monolith.png)

In this architecture, the application is divided into modules. Each module is responsible for a specific feature or functionality. However, unlike microservices, these modules run in the same process and communicate directly with each other. Modular monoliths can be containerized as a single unit, which helps with deployment and scaling of the entire application, but doesn't allow for independent scaling of individual modules. In short they suffer from the same limitations as traditional monolithic server-based architectures.

While modules are separate, they typically share a common database, simplifying data management but also create a tight coupling between modules. This shared database approach makes it easier to maintain data consistency across the application but can lead to challenges as the application grows and modules become more complex. Also this means modules don't have true data sovereignty, as they don't exclusively own or control their data. This can lead to interdependencies between modules and make it challenging to evolve or replace individual modules without affecting others.

Although not as critical as in microservices, clearly defined boundaries between modules are important for maintainability in modular monoliths. These boundaries help in organizing code, reducing dependencies between modules, and making the system easier to understand and modify. However, because all modules run in the same process, there's still a risk that changes in one module can affect others, and the technology diversity is limited compared to more distributed architectures.

## Service-oriented architecture

![A diagram showing a SOA.](media/service-oriented-architecture.png)

In Service-Oriented Architecture (SOA), services are the main components. Each service encompasses an entire business process or function. For example, a customer order service would include functionality to manage not only orders but also customer information, shipping, and billing. Services communicate with each other to perform their tasks, typically using a messaging broker or a central enterprise bus.

Data management in SOA can be challenging. Traditionally, services often share databases, which can lead to tight coupling. Moving towards data sovereignty, where each service owns its data, can improve service independence but introduces challenges in maintaining data consistency across services. This shift improves service independence but introduces new challenges in maintaining data consistency across services. SOA implementations must balance the benefits of data sovereignty with the need for data sharing and consistency across business processes.

Communication is a crucial aspect of SOA. While not as granular as microservices, SOA relies heavily on inter-service communication, often through a centralized bus. This central communication mechanism can provide benefits in terms of standardization and ease of management, but it can also become a performance bottleneck and single point of failure if not designed carefully.

## Microservices

![A diagram showing a microservices based architecture.](media/microservice-architecture.png)

Microservices architecture breaks down the application into smaller, independent services that perform specific tasks. These services can be developed, deployed, and scaled independently. Microservices are well-suited for containerization, and allow each service to be deployed and scaled independently, which aligns well with cloud-native development practices.

In microservices, each service typically adheres to the principle of data sovereignty. Each microservice owns and manages its own data store, which can be a database, cache, or any other form of data storage. This sovereignty ensures that a service has complete control over its data model, storage technology, and data access patterns. It reduces coupling between services, as no service can directly access or modify another service's data. Instead, data exchange happens through well-defined APIs or messaging systems. This approach supports the independence and autonomy of each microservice, allowing teams to make decisions about data storage and management that are optimal for their specific service without affecting others. However, it also introduces challenges in maintaining data consistency across the system. Solutions to these challenges include using event-driven architectures, implementing the Saga pattern for distributed transactions, and designing for eventual consistency where appropriate.

The logical architecture of a microservices system, that us how services are conceptually organized, can be quite different from its physical architecture, that is how they're deployed. This separation allows for optimal resource utilization and adaptation to changing infrastructure requirements.

Identifying correct domain-model boundaries for each microservice is crucial to ensure each service has a well-defined responsibility and to reduce inter-service dependencies. This process often involves careful analysis of the business domain and can significantly impact the overall system design.

Communication patterns in microservices architectures are diverse. They can involve direct client-to-microservice communication or use an API Gateway pattern. Direct communication can offer lower latency but increases complexity for clients, while an API Gateway can simplify the client experience but may introduce a potential single point of failure. Additionally, microservices can communicate with each other using both synchronous (HTTP/gRPC) and asynchronous (message queues) methods, each with its own implications on system design and behavior.

### .NET Aspire and microservices

Although a microservices architecture is well suited to large apps with complex scaling needs and continuous development, you've seen that they're not always easy to manage. For example, sometimes it's hard to determine exactly which microservices and other components make up your entire app. Also, because each microservice might be written by a different team, common concerns like observability and resiliency may be implemented inconsistently or not at all.

This is where .NET Aspire comes in - it's a stack that helps you create manageable and consistent microservices, and assemble them into large apps. You can build .NET microservices without .NET Aspire, but if you do you'll have to work harder to solve common problems. For example, .NET Aspire:

- Makes it clear which microservices and other components are part of your app. You can see them in the App Host project code, and in the dashboard that appears whenever you debug your app.
- Implements observability for you using OpenTelemetry, so you can easily get data on the performance and behavior of all your microservices without requiring your development teams to build it.
- Makes it easy to use common backing services, such as databases and service buses, by providing out-of-the-box integrations for each one.
- Implements resiliency in these integrations to prevent and recover from failures, without requiring your development teams to build it.

If you've already started building and deploying microservices apps, then .NET Aspire may not help you, because it's opinionated about how they should be built and that might not match your design. However, if you're new to microservices and cloud-native design, or if you're starting an app from scratch, it can help to make the project easier and reduce development time.

>[!div class="step-by-step"]
>[Previous](why-choose-distributed-architecture.md)
>[Next](../communication-patterns/communication-patterns.md)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: Architecting distributed cloud-native applications
description: Architecture for Distributed Cloud-Native Apps with .NET Aspire & Containers | Architecting distributed cloud-native applications
author:
ms.date: 04/06/2022
---

# Architecting distributed cloud-native applications

[!INCLUDE [download-alert](../includes/download-alert.md)]

Every application has its own unique requirements, but there are some common patterns and best practices that can help you design and build distributed cloud-native applications. In this book, we're focusing on how to architect distributed cloud-native applications by taking a microservices approach. But this approach might not be the best fit for your application. Let's look at why you might choose a distributed architecture.

- **Scalability**: Distributed architectures allow applications to scale out easily, accommodating more users and handling more requests per second. This is particularly important for applications that experience variable load.

- **Resilience**: In a distributed system, if one component fails, the others can continue to operate. This resilience can increase the overall uptime and reliability of your application.

- **Geographical distribution**: For global applications, distributed architectures can reduce latency by locating services closer to users.

- **Isolation of responsibilities**: Each service in a distributed system can be developed, deployed, scaled, and maintained independently, often by different teams. This separation can lead to increased productivity and speed of development.

- **Technology diversity**: Different services in a distributed system can use different languages, databases, and other technologies. You can choose the best performing tool for each job and the one that your team has experience with.

- **Efficient resource utilization**: Distributed architectures can make more efficient use of resources by allowing each service to scale independently based on its needs. For example, reporting services can be scaled up at the end of each month when managers build reports, while your core e-commerce services can be scaled up during peak shopping seasons.

- **Ease of deployment and updates**: With a distributed architecture, you can update a single service without having to redeploy your entire application. This independence can make deployments faster and less risky allowing for more frequent updates.

- **Data partitioning**: In a distributed system, you can partition your data across different services, which can lead to improved performance and scalability. You can also geographically partition your data to comply with data residency requirements.

- **Security**: By isolating different parts of your application into separate services, you can apply specific security measures to each service based on its needs.

In the rest of this book we'll be focusing specifically on how to design and build distributed cloud-native applications using a microservices based architecture. You'll see how the features built into .NET are designed to help you build and deploy microservices, and how to use containers to package and deploy your services successfully.

>[!div class="step-by-step"]
>[Previous](../introduction-dot-net-aspire/observability-and-dashboard.md)
>[Next](different-distributed-architectures.md)
Loading
Loading