Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
e2dd8e7
Merge branch 'master' of https://github.com/dotnet/docs
robvet Sep 3, 2019
afcdd52
Merge remote-tracking branch 'upstream/cloud-native'
robvet Sep 4, 2019
63a6f43
Merge branch 'master' of https://github.com/dotnet/docs
robvet Sep 12, 2019
053c488
:XMerge branch 'cloud-native' of https://github.com/dotnet/docs
robvet Sep 12, 2019
1ef1386
:XMerge branch 'master' of https://github.com/dotnet/docs
robvet Sep 12, 2019
869a073
Merge branch 'master' of https://github.com/robvet/docs
robvet Oct 22, 2019
3d9de61
10-22 Ch 5 PR
robvet Oct 22, 2019
faaec2b
10-22 Ch 5 PR - fix images
robvet Oct 22, 2019
427f9af
10-22 Ch5 PR Update #1
robvet Oct 23, 2019
96fa8b0
10-23 Ch 5 fine-tuning verbage
robvet Oct 24, 2019
83249fd
Update docs/architecture/cloud-native/distributed-data.md
robvet Oct 26, 2019
5885cfa
10-27 Ch 5 Empty commit
robvet Oct 27, 2019
5de82a1
10-29 Ch 5 Updated intro
robvet Oct 29, 2019
74ac476
Merge branch 'master' into chapter-5-octupdates
robvet Oct 29, 2019
5c0ce29
11-01 Ch5 Cleansing Section 2
robvet Nov 2, 2019
1bcb68e
11-1 CH5 Updated Date
robvet Nov 2, 2019
845d97e
11-02 Ch 5 Section 2 updates
robvet Nov 3, 2019
fee7e4f
11-3 Ch 5 Section 2 fine tuning
robvet Nov 3, 2019
8f67b79
11-3 Ch 5 Section 2 more fine tuning
robvet Nov 3, 2019
ff50280
11-3 ch 5 updates to section 3
robvet Nov 4, 2019
8e620d5
11-4 Chatper 5 Section 3
robvet Nov 5, 2019
4b0da00
11-06 Chapter 5 final update-pass 1
robvet Nov 6, 2019
358523c
Updated changes to Ch 5
robvet Nov 6, 2019
4ba9132
11-28 Ch 5 consolidated images in section 1
robvet Nov 28, 2019
53407af
11-28 Ch 5 Updated Section 1
robvet Nov 28, 2019
e2d3242
11-28 Ch 5 Updated Section 1 - fix md error
robvet Nov 28, 2019
8a37d0c
11-28 Ch 5 Consolidating Section 1 and 2
robvet Nov 28, 2019
0721029
11-29 Ch 5 setion 1
robvet Nov 30, 2019
bbc23db
12/5 Ch 5 Section 1
robvet Dec 6, 2019
6ca61d7
12-6 Ch 5 Event sourcing
robvet Dec 7, 2019
ce17f48
12/8 ch 5 event sourcing
robvet Dec 8, 2019
745c598
12/8 Chapter 5 Event Sourcing Section 1 complete
robvet Dec 8, 2019
f9db6bb
12/8 Ch 5 added caching and updated TOC
robvet Dec 9, 2019
9df7791
12/8 Ch 5 fix md fomratting error
robvet Dec 9, 2019
c6df5fd
12/8 Ch 5 fix 2nd md fomratting error
robvet Dec 9, 2019
5d50a4a
12/8 Ch 5 fix 3rd md fomratting error
robvet Dec 9, 2019
5d5e471
12/18 Caching section complete
robvet Dec 19, 2019
fa31ae7
12/18 Caching section complete 2
robvet Dec 19, 2019
9e6e93e
12/19 Ch 5 updates to sql vs nosql
robvet Dec 20, 2019
9106db8
12/19 Ch 5 updates to sql vs nosql2
robvet Dec 20, 2019
9e64ace
12/19 Ch 5 updates to sql vs nosql3
robvet Dec 20, 2019
beaebc8
12/19 Ch 5 updates to sql vs nosql4
robvet Dec 20, 2019
25f0289
12/20 Ch 5 update to caching
robvet Dec 21, 2019
64cf68b
12/20 Ch 5
robvet Dec 21, 2019
4d690f7
Merge branch 'master' into chapter-5-octupdates
robvet Dec 21, 2019
e0268ec
12/21 Ch 5 WIP NoSQL vs SQL
robvet Dec 21, 2019
bd8cfe4
Merge branch 'chapter-5-octupdates' of https://github.com/robvet/docs…
robvet Dec 21, 2019
c64dcf9
12/21 Ch 5 WIP NoSQL vs SQL2
robvet Dec 21, 2019
288e770
12/21 Ch 5 WIP SQL vs NoSQL
robvet Dec 22, 2019
abb97f1
12/22 Ch 5
robvet Dec 23, 2019
4c8b8c0
12/23 Ch 5 All except customer stories and ElaticSearch
robvet Dec 24, 2019
418a75b
12-24 Ch 5 Fine tuning to Sql vs NoSql
robvet Dec 24, 2019
4cdfe1c
12/24 chapter 5 fine tuning to sql vs nosql
robvet Dec 25, 2019
a250470
12/25 Ch 5 more fine tuning to sql vs nosql
robvet Dec 25, 2019
8e6c4cc
12/25 Updates to navigation
robvet Dec 25, 2019
557b5b6
12/25 Ch 5 added consistency graphic
robvet Dec 25, 2019
77b01d1
12/25 Ch 5 corrections
robvet Dec 26, 2019
dcaf63c
12/27 Enhancing CosmosDB and NewSQL sections
robvet Dec 28, 2019
5824634
12/27 Enhancing CosmosDB and NewSQL sections
robvet Dec 28, 2019
c670c99
12/29 Ch5 adding elasticsearch
robvet Dec 29, 2019
f9441ea
12/29 Ch 5 lowercasing file name for Database-per-microservice
robvet Dec 29, 2019
1f81c02
12/29 Ch 5 elastic complete first pass
robvet Dec 30, 2019
33b9ed8
12/30 CH 5 updates to Cosmos Table API
robvet Dec 30, 2019
6c72e05
12/30 Ch 5 fine-tuning verbage
robvet Dec 30, 2019
2f9005a
12/31 Ch 5 final wrap#1
robvet Dec 31, 2019
5a673a3
12/31 Ch 5 final wrap#1 - fix link
robvet Dec 31, 2019
4005931
Update docs/architecture/cloud-native/Database-per-microservice.md
robvet Jan 20, 2020
4403e1e
Update docs/architecture/cloud-native/Database-per-microservice.md
robvet Jan 20, 2020
716d5f1
Update docs/architecture/cloud-native/Database-per-microservice.md
robvet Jan 20, 2020
70c0354
Update docs/architecture/cloud-native/Database-per-microservice.md
robvet Jan 20, 2020
123e793
Update docs/architecture/cloud-native/azure-caching.md
robvet Jan 20, 2020
d3b6558
Update docs/architecture/cloud-native/azure-caching.md
robvet Jan 20, 2020
754e296
Update docs/architecture/cloud-native/Database-per-microservice.md
robvet Jan 20, 2020
51aec25
Update docs/architecture/cloud-native/Database-per-microservice.md
robvet Jan 20, 2020
5704f6c
Update docs/architecture/cloud-native/Database-per-microservice.md
robvet Jan 20, 2020
1bad63b
Update docs/architecture/cloud-native/azure-caching.md
robvet Jan 20, 2020
758016b
Update docs/architecture/cloud-native/azure-caching.md
robvet Jan 20, 2020
74709e5
Update docs/architecture/cloud-native/elastic-search-in-azure.md
robvet Jan 20, 2020
ef89e95
Update docs/architecture/cloud-native/elastic-search-in-azure.md
robvet Jan 20, 2020
0c1b08e
Update docs/architecture/cloud-native/relational-vs-nosql-data.md
robvet Jan 20, 2020
3328bca
Update docs/architecture/cloud-native/relational-vs-nosql-data.md
robvet Jan 20, 2020
cf16bc5
Update docs/architecture/cloud-native/relational-vs-nosql-data.md
robvet Jan 20, 2020
6c7bde0
Update docs/architecture/cloud-native/relational-vs-nosql-data.md
robvet Jan 20, 2020
058aedd
Update docs/architecture/cloud-native/relational-vs-nosql-data.md
robvet Jan 20, 2020
52bbf85
Update docs/architecture/cloud-native/relational-vs-nosql-data.md
robvet Jan 20, 2020
45eb34a
Update docs/architecture/cloud-native/Database-per-microservice.md
robvet Jan 20, 2020
5d693d4
Updates responding to PR comments from Nish and Maira
robvet Jan 21, 2020
de7dfc2
Updates suggested by Nish and Maira
robvet Jan 21, 2020
15edb3b
Ch5 Push with PR Corrections
robvet Jan 22, 2020
4e8a6fe
Merge remote-tracking branch 'upstream/master' into chapter-5-octupdates
robvet Jan 22, 2020
5ffe384
Ch 5 fix warnings
robvet Jan 22, 2020
153e9ea
Ch 5 fix more warnings
robvet Jan 22, 2020
306a398
Ch 5 fix even more warnings
robvet Jan 22, 2020
d01029d
Apply suggestions from code review
robvet Jan 23, 2020
ced37e3
rename
robvet Jan 23, 2020
7cd1815
rename #2
robvet Jan 23, 2020
18e5796
Apply suggestions from code review
robvet Jan 23, 2020
611639b
Update to TOC
robvet Jan 23, 2020
b1a15e4
Apply suggestions from code review
robvet Jan 23, 2020
d65a8d1
Update docs/architecture/cloud-native/relational-vs-nosql-data.md
robvet Jan 24, 2020
b55eccf
Update docs/architecture/cloud-native/relational-vs-nosql-data.md
robvet Jan 24, 2020
7e71458
Update docs/architecture/cloud-native/relational-vs-nosql-data.md
robvet Jan 24, 2020
f93e1c5
Update docs/architecture/cloud-native/relational-vs-nosql-data.md
robvet Jan 24, 2020
dbf6061
Update docs/architecture/cloud-native/relational-vs-nosql-data.md
robvet Jan 24, 2020
dd4dae4
Update docs/architecture/cloud-native/relational-vs-nosql-data.md
robvet Jan 24, 2020
643bfb2
Removed NewSQL Database image
robvet Jan 24, 2020
01e0386
set up redirects
mairaw Jan 27, 2020
d6ae5d0
fix redirect
mairaw Jan 27, 2020
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
12 changes: 12 additions & 0 deletions .openpublishing.redirection.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@
"source_path": "docs/about/products.md",
"redirect_url": "/dotnet/standard/components"
},
{
"source_path": "docs/architecture/cloud-native/azure-data-storage.md",
"redirect_url": "/dotnet/architecture/cloud-native/relational-vs-nosql-data"
},
{
"source_path": "docs/architecture/cloud-native/data-patterns.md",
"redirect_url": "/dotnet/architecture/cloud-native/database-per-microservice"
},
{
"source_path": "docs/architecture/cloud-native/distributed-data.md",
"redirect_url": "/dotnet/architecture/cloud-native/database-per-microservice"
},
{
"source_path": "docs/architecture/microservices/architect-microservice-container-applications/communication-between-microservices.md",
"redirect_url": "/dotnet/architecture/microservices/architect-microservice-container-applications/communication-in-microservice-architecture",
Expand Down
60 changes: 60 additions & 0 deletions docs/architecture/cloud-native/azure-caching.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
title: Caching in a cloud-native application
description: Learn about caching strategies in a cloud-native application.
author: robvet
ms.date: 01/22/2020
---
# Caching in a cloud-native app

[!INCLUDE [book-preview](../../../includes/book-preview.md)]

The benefits of caching are well understood. The technique works by temporarily copying frequently accessed data from a backend data store to *fast storage* that's located closer to the application. Caching is often implemented where...

- Data remains relatively static.
- Data access is slow, especially compared to the speed of the cache.
- Data is subject to high levels of contention.

## Why?

As discussed in the [Microsoft caching guidance](https://docs.microsoft.com/azure/architecture/best-practices/caching), caching can increase performance, scalability, and availability for individual microservices and the system as a whole. It reduces the latency and contention of handling large volumes of concurrent requests to a data store. As data volume and the number of users increase, the greater the benefits of caching become.

Caching is most effective when a client repeatedly reads data that is immutable or that changes infrequently. Examples include reference information such as product and pricing information, or shared static resources that are costly to construct.

While microservices should be stateless, a distributed cache can support concurrent access to session state data when absolutely required.

Also consider caching to avoid repetitive computations. If an operation transforms data or performs a complicated calculation, cache the result for subsequent requests.

## Caching architecture

Cloud native applications typically implement a distributed caching architecture. The cache is hosted as a cloud-based [backing service](./definition.md#backing-services), separate from the microservices. Figure 5-20 shows the architecture.

![Caching in a cloud native app](media/caching-in-a-cloud-native-app.png)

**Figure 5-19**: Caching in a cloud native app

In the previous figure, note how the cache is independent of and shared by the microservices. In this scenario, the cache is invoked by the [API Gateway](./front-end-communication.md). As discussed in chapter 4, the gateway serves as a front end for all incoming requests. The distributed cache increases system responsiveness by returning cached data whenever possible. Additionally, separating the cache from the services allows the cache to scale up or out independently to meet increased traffic demands.

The figure presents a common caching pattern known as the [cache-aside pattern](https://docs.microsoft.com/azure/architecture/patterns/cache-aside). For an incoming request, you first query the cache (step \#1) for a response. If found, the data is returned immediately. If the data doesn't exist in the cache (known as a [cache miss](https://www.techopedia.com/definition/6308/cache-miss)), it's retrieved from a local database in a downstream service (step \#2). It's then written to the cache for future requests (step \#3), and returned to the caller. Care must be taken to periodically evict cached data so that the system remains timely and consistent.

As a shared cache grows, it might prove beneficial to partition its data across multiple nodes. Doing so can help minimize contention and improve scalability. Many Caching services support the ability to dynamically add and remove nodes and rebalance data across partitions. This approach typically involves clustering. Clustering exposes a collection of federated nodes as a seamless, single cache. Internally, however, the data is dispersed across the nodes following a predefined distribution strategy that balances the load evenly.

## Azure Cache for Redis

[Azure Cache for Redis](https://azure.microsoft.com/services/cache/) is a secure data caching and messaging broker service, fully managed by Microsoft. Consumed as a Platform as a Service (PaaS) offering, it provides high throughput and low-latency access to data. The service is accessible to any application within or outside of Azure.

The Azure Cache for Redis service manages access to open-source Redis servers hosted across Azure data centers. The service acts as a facade providing management, access control, and security. The service natively supports a rich set of data structures, including strings, hashes, lists, and sets. If your application already uses Redis, it will work as-is with Azure Cache for Redis.

Azure Cache for Redis is more than a simple cache server. It can support a number of scenarios to enhance a microservices architecture:

- An in-memory data store
- A distributed non-relational database
- A message broker
- A configuration or discovery server

For advanced scenarios, a copy of the cached data can be [persisted to disk](https://docs.microsoft.com/azure/azure-cache-for-redis/cache-how-to-premium-persistence). If a catastrophic event disables both the primary and replica caches, the cache is reconstructed from the most recent snapshot.

Azure Redis Cache is available across a number of predefined configurations and pricing tiers. The [Premium tier](https://docs.microsoft.com/azure/azure-cache-for-redis/cache-premium-tier-intro) features many enterprise-level features such as clustering, data persistence, geo-replication, and virtual-network isolation.

>[!div class="step-by-step"]
>[Previous](relational-vs-nosql-data.md)
>[Next](elastic-search-in-azure.md)
Loading