[go: up one dir, main page]

0% found this document useful (0 votes)
162 views51 pages

ACAv3 EN M12 CachingContent Instructor Deck

Uploaded by

forstudies555
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
162 views51 pages

ACAv3 EN M12 CachingContent Instructor Deck

Uploaded by

forstudies555
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 51

Caching Content

AWS Academy Cloud


Architecting

1
Introduction
Caching Content

2
Module objectives This module prepares you to do the following:
• Identify how caching content can improve application
performance and reduce latency.
• Identify how to use Amazon CloudFront to deliver
content by using edge locations protection.
• Create architectures that use CloudFront to cache
content.
• Describe how to use Amazon ElastiCache for
database caching.
• Use the AWS Well-Architected Framework principles
when designing caching strategies.

3
Module overview
Presentation sections Knowledge checks
• Overview of caching • 10-question knowledge check
• Caching using CloudFront • Sample exam question
• Caching using ElastiCache
• Applying AWS Well-Architected
Framework principles to caching

4
Hands-on labs in this module
Guided lab
• Streaming Dynamic Content Using Amazon CloudFront

5
As a cloud architect • I need to determine when and how to provide a
designing content faster way for my customers to access content
caching: so that I can balance performance, cost, and
data freshness to meet evolving business
requirements.
• I need to incorporate a content delivery
network (CDN) service in my architecture
designs so that I can distribute static content
securely and efficiently.
• I need to select an in-memory caching strategy
so that I can reduce network latency and
offload database pressure.

6
Overview of caching
Caching Content

7
Why cache content?
A cache is a high-speed data storage layer that stores a subset of data so that
future requests for that data are served up faster.

Store regularly accessed Increase data retrieval Reduce the need to


data in a more optimized performance. access the underlying
way. slower storage layer.

8
Caching analogy

Travel time to store = 30 minutes

Your house Hardware


store

Travel time to shed = 2 minutes

Your house Tool shed

9
What should you cache?

Static and frequently Results of Results of time-consuming,


accessed data computationally frequently used, or
intensive calculations complex database queries

10
Trade-offs to consider when caching
Benefits of caching Challenges of caching
• Reduces response latency • Requires additional engineering
• Reduces cost • Requires someone to determine how
• Alleviates the load on the origin to cache data and deal with stale
(data source) data based on the business use case
• Provides predictable performance
• Improves availability

11
Types of caching and AWS caching services

Amazon CloudFront Amazon ElastiCache

Static caching (edge caching) Database caching (data caching)


Retrieve content from the nearest Retrieve content from an in-memory
edge location. database layer.

12
Key takeaways: • A cache is a high-speed data storage layer that
Overview of caching stores a subset of data so that future requests
for that data are served up faster.
• Static and frequently accessed data are good
candidates for caching.
• Caching improves application speed and
decreases database cost.
• Content is retrieved from the nearest edge
location with static caching and retrieved from
an in-memory database layer with database
caching.

13
Caching using CloudFront
Caching Content

14
Content delivery network (CDN)
Delivery challenge CDN solution
Deliver geographically • Is a globally distributed system of caching
dispersed content with servers
low latency and low cost • Has intermediary servers between the client and
for end users to access. the application
• Caches copies of commonly requested files
(static content)
• Delivers a local copy of the requested content
from a nearby cache edge or point of presence

15
Which type of content can you cache by using an edge cache?

User-generated data
Dynamically generated cannot be cached by
content cannot be using an edge cache.
cached by using an edge
cache.

Web objects
can be cached.

Images
can be cached. Videos
can be cached.

16
CloudFront

• Is a CDN service that delivers content across the


globe securely with low latency and high transfer
speeds
• Provides high-speed content distribution by
delivering through edge locations
CloudFront • Improves application resiliency from distributed
denial of service (DDoS) attacks by leveraging
services such as AWS Shield and AWS WAF

17
CloudFront global edge network components
CloudFront edge locations CloudFront Regional edge caches
• Are more numerous and closer to • Are fewer and farther away from
users users
• Have smaller caches • Have larger caches
• Help ensure that popular content can • Helps with less popular content in
be served quickly to viewers particular

User Edge Regional edge


Origin
location cache
location
18
How caching works in CloudFront
AWS Cloud
CloudFront
Region

1 2 Edge node 3

5 Internet Edge node 4 S3 bucket


User with cat.jpg origin
with cat.jpg

Edge node Based on time to live


(TTL) caching, the
cached image will
Edge node become stale if the
origin is updated.

19
How to configure a CloudFront distribution

Specify an Configure CloudFront CloudFront sends


origin location. the distribution. becomes your distribution’s
available.
configuration to
edge locations.
20
Controlling how long content is cached
Specify
Set a maximum TTL Implement content Use CloudFront
cache-control
value versioning invalidation requests
headers
Expires cached Fetches and caches Provides precise Forces CloudFront
content faster with a new files control over content to expire content
low maximum TTL immediately expiration for from edge caches
value individual files

21
Using CloudFront for video streaming
AWS Cloud
The
dynamic
stream is
delivered.

Source Amazon Elastic Amazon S3 Amazon User mobile


content Transcoder CloudFront device
The input video The converted
is converted output is stored
into multiple in an S3 bucket.
output formats.

22
DDoS mitigation
Security challenge CloudFront solution
Publicly accessible • Monitoring and mitigation are built into Amazon
content is exposed to Route 53 as it routes traffic to CloudFront.
common web threats that • CloudFront can create an AWS WAF web access
affect availability and control list (ACL) that configures rules to analyze
compromise security. incoming requests and block threats before they
reach your servers.
• Shield DDoS mitigations allow only traffic that is
valid for web applications to pass through to
CloudFront.

23
Key takeaways: • Static file caching is done by using a CDN.
Caching using • CloudFront is a CDN service that uses edge
CloudFront locations and Regional edge caches to deliver
content securely across the globe.
• You can control CloudFront caching behavior
by using a combination of actions.
• By using CloudFront for distributing content,
you are also protecting your systems from
DDoS attacks.

24
Guided lab: Streaming Dynamic Content
Using Amazon CloudFront (CloudFront lab)

25
CloudFront lab In this lab, you perform the following main
tasks: tasks:
• Create an Amazon CloudFront distribution.
• Create an Amazon Elastic Transcoder pipeline.
• Test playback of the dynamic (multiple bitrate)
stream.

26
Debrief: CloudFront lab
• What did you specify as the origin that will be used to deliver the multiple
bit-rate files generated by Amazon Elastic Transcoder to end-user devices?
• Which two components does the playback URL that plays through Amazon
CloudFront consist of?

27
Caching using ElastiCache
Caching Content

28
When should you cache your database?

You are concerned about You have a high volume of You want to reduce your
response times for your requests that are database costs.
customer. overburdening your
database.

29
ElastiCache

• Is a fully managed, key-value, in-memory data store


with sub-millisecond latency
• Sits between an application and an origin data store
• Decreases access latency and eases the load of
databases and applications
• Provides a high performance and cost-effective in-
ElastiCache
memory cache
• Is fully compatible with open source Redis and
Memcached engines
30
Choose an ElastiCache engine based on what you need
• the most basic model
• the ability to run large nodes with
Choose
If you need: multiple cores or threads
• the ability to scale horizontally with Auto ElastiCache
Discovery for Memcached

• to support complex data types


• to provide persistence of your key store
• to sort or rank in-memory datasets Choose
If you need:
• to provide high availability with automatic ElastiCache
failover for Redis
• to support publish/subscribe messaging

31
ElastiCache components

A node is the smallest block


of an ElastiCache deployment.

An ElastiCache cluster is a
logical grouping of one or
more nodes.
ElastiCache

With the Memcached engine, data is


partitioned across up to 20 nodes in
a cluster. With the Redis engine, you
ElastiCache cluster can scale up to 250 nodes.

32
Time to live (TTL)

• A TTL value is added to each write.


• The TTL specifies the number of seconds or milliseconds
until the key expires.
• After the TTL expires, the application queries the
database for data.

33
Strategies for handling stale data
Features Lazy Loading Write-Through
This strategy updates the cache
This strategy updates the cache
Caching Pattern immediately after updating the
after the data is requested.
primary database.

The cache is up-to-date with the


The cache contains only data that
Advantage primary database (most likely data
the application actually requests.
will be found in the cache).

This strategy requires a This strategy results in an increase


Disadvantage programmatic strategy to handle in cost from storing data in-
keeping the cache as up to date. memory that you might not use.

34
Caching strategies: Lazy loading
Lower latency
response to the
requester Requested
If yes = If no = cache 2b
2a data in the
cache hit miss
cache?
Reduced
load on the
primary
database

Data request Data copied to the cache for


1
future requests
User application Database
Cache node

35
Caching strategies: Write-through

2
Updates
the cache
User application Database
Cache node

Writes to the database


1

36
Key takeaways: • ElastiCache is a key-value, in-memory data
Caching using store with the purpose of providing millisecond
ElastiCache latency and inexpensive access to copies of
data.
• ElastiCache reduces the complexity of
administering your caching systems for Redis
and Memcached engines.
• Lazy loading and write-through are two
strategies to handle keeping the cache as up to
date as is appropriate.

37
Applying the AWS Well-Architected
Framework principles to caching
Caching Content

38
AWS Well-Architected Framework caching best practices

39
Best practice approach: Data management

Best practices

Implement data access patterns that


utilize caching.

Implement strategies to improve query


performance in data store.

40
Best practice approach: Foundations – plan your network topology

Best practice
Use highly available network
connectivity for your workload public
endpoints.

41
Best practice approach: Cost-effective resources - plan for data transfer

Best practices

Perform data transfer modeling.

Select components to optimize data


transfer cost.

Implement services to reduce data


transfer costs.

42
Key takeaways: • Consider best practices in the performance efficiency
Applying AWS Well - pillar such as making selection choices based on data
Architected Framework characteristics and available options.
principles to caching • Consider best practices in the reliability pillar such as
using highly available network connectivity for your
public endpoints.
• Consider best practices in the cost optimization pillar
such as implementing services to reduce data transfer
costs.

43
Module wrap-up
Caching Content

44
Module summary
This module prepared you to do the following:
• Identify how caching content can improve application performance and reduce latency.
• Identify how to use Amazon CloudFront to deliver content by using edge locations
protection.
• Create architectures that use CloudFront to cache content.
• Describe how to use ElastiCache for database caching.
• Use the AWS Well-Architected Framework principles when designing caching
strategies.

45
Considerations for the café
• Discuss how you as a cloud architect might advise
the café based on the key cloud architect concerns
presented at the start of this module.

46
Module knowledge • The knowledge check is delivered online
check within your course.
• The knowledge check includes 10 questions
based on material presented on the slides and in
the slide notes.
• You can retake the knowledge check as many
times as you like.

47
Sample exam question
Your company is hosting an ecommerce site and storing the records in an Amazon RDS database. After a few days, the Amazon
RDS database is experiencing serious performance issues due to website requests. Which option is the most cost-effective way
to deal with the performance issues due to many read requests?

Identify the key words and phrases before continuing.

The following are the key words and phrases:

• Amazon RDS database

• cost-effective

• performance issues due to many read requests

48
Sample exam question: Response choices
Your company is hosting an ecommerce site and storing the records in an Amazon RDS database. After a few days, the
Amazon RDS database is experiencing serious performance issues due to website requests. Which option is the most cost-
effective way to deal with the performance issues due to many read requests?

Choice Response

A Enable the Multi-AZ feature for the Amazon RDS database.

B Configure Amazon ElastiCache to cache frequently used content from the database.

C Place a load balancer in front of the database.

D Configure Amazon CloudFront to cache content from the database.

49
Sample exam question: Answer
The answer is B.

Choice Response

B Configure Amazon ElastiCache to cache frequently used content from the database.

50
Thank you

Corrections, feedback, or other questions?


Contact us at https://support.aws.amazon.com/#/contacts/aws-academy.

51

You might also like