AZ-204 Cache Flashcards

1
Q

What are the Service tiers for Redis?

A

Basic - An OSS Redis cache running on a single VM. This tier has no service-level agreement (SLA) and is ideal for development/test and non-critical workloads.

Standard - An OSS Redis cache running on two VMs in a replicated configuration.

Premium - High-performance OSS Redis caches. This tier offers higher throughput, lower latency, better availability, and more features. Premium caches are deployed on more powerful VMs compared to the VMs for Basic or Standard caches.

Enterprise - High-performance caches powered by Redis Labs’ Redis Enterprise software. This tier supports Redis modules including RediSearch, RedisBloom, and RedisTimeSeries. Also, it offers even higher availability than the Premium tier.

Enterprise Flash - Cost-effective large caches powered by Redis Labs’ Redis Enterprise software. This tier extends Redis data storage to non-volatile memory, which is cheaper than DRAM, on a VM. It reduces the overall per-GB memory cost.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the Data Cache pattern?

A

Databases are often too large to load directly into a cache. It’s common to use the cache-aside pattern to load data into the cache only as needed. When the system makes changes to the data, the system can also update the cache, which is then distributed to other clients.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the Content Cache pattern?

A

Many web pages are generated from templates that use static content such as headers, footers, banners. These static items shouldn’t change often. Using an in-memory cache provides quick access to static content compared to backend datastores.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the Session Store pattern?

A

This pattern is commonly used with shopping carts and other user history data that a web application might associate with user cookies. Storing too much in a cookie can have a negative effect on performance as the cookie size grows and is passed and validated with every request. A typical solution uses the cookie as a key to query the data in a database. Using an in-memory cache, like Azure Cache for Redis, to associate information with a user is much faster than interacting with a full relational database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the job and messaging queue pattern?

A

Applications often add tasks to a queue when the operations associated with the request take time to execute. Longer running operations are queued to be processed in sequence, often by another server. This method of deferring work is called task queuing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the distributed transactions pattern?

A

Applications sometimes require a series of commands against a backend data-store to execute as a single atomic operation. All commands must succeed, or all must be rolled back to the initial state. Azure Cache for Redis supports executing a batch of commands as a single transaction.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the 3 pricing tiers for Redis?

A
  • Basic: Basic cache ideal for development/testing. Is limited to a single server, 53 GB of memory, and 20,000 connections. There is no SLA for this service tier.
  • Standard: Production cache which supports replication and includes an SLA. It supports two servers, and has the same memory/connection limits as the Basic tier.
  • Premium: Enterprise tier which builds on the Standard tier and includes persistence, clustering, and scale-out cache support. This is the highest performing tier with up to 530 GB of memory and 40,000 simultaneous connections.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the recommendations for configuring Cache for Redis?

A

-Name needs to be globally unique
- Location and app should be in the same region
- standard/premium tier for prod
-if a vnet is needed use premium tier
- if clustering/sharding needed use preimium

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What do you need to access Redis from a client?

A

To connect to an Azure Cache for Redis instance, you’ll need several pieces of information. Clients need the host name, port, and an access key for the cache. You can retrieve this information in the Azure portal through the Settings > Access Keys page.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you connect the Redis cache using StackExchange.Redis?

A

using StackExchange.Redis;

var connectionString = “[cache-name].redis.cache.windows.net:6380,password=[password-here],ssl=True,abortConnect=False”;
var redisConnection = ConnectionMultiplexer.Connect(connectionString);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do you access a redi db?

A

IDatabase db = redisConnection.GetDatabase();

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How do you close the Redi connection?

A

redisConnection.Dispose();
redisConnection = null;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How do Azure CDNs work?

A

User requests a file from any type of server, if no edge servers in the POP have the file the server returns the file to the edge server. An edge sever in the POP stores the file in the cache and delivers it to the requested user. For the rest of the TTL the file is stored in cache and will be significantly faster for other users requesting the same file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a CDN profile?

A

Collection of CDN endpoints. at least 1 cdn profile is required to use Azure CDN.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the Azure subscription limitations?

A

The number of CDN profiles that can be created.
The number of endpoints that can be created in a CDN profile.
The number of custom domains that can be mapped to an endpoint.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are the 4 CDN networks?

A

Azure CDN Standard from Microsoft
Azure CDN Standard from Akamai
Azure CDN Standard from Verizon
Azure CDN Premium from Verizon

17
Q

What are the CLI purge and preload commands for cdns?

A

az cdn endpoint purge \
–content-paths ‘/css/*’ ‘/js/app.js’ \
–name ContosoEndpoint \
–profile-name DemoProfile \
–resource-group ExampleGroup

az cdn endpoint load \
–content-paths ‘/img/*’ ‘/js/module.js’ \
–name ContosoEndpoint \
–profile-name DemoProfile \
–resource-group ExampleGroup

18
Q

What is cdn geo-filtering?

A

Geo-filtering enables you to allow or block content in specific countries/regions, based on the country/region code.

19
Q

what are the default time to live values?

A

Generalized web delivery optimizations: seven days
Large file optimizations: one day
Media streaming optimizations: one year

20
Q

how do you create a CDN Client?

A

static void Main(string[] args)
{
// Create CDN client
CdnManagementClient cdn = new CdnManagementClient(new TokenCredentials(authResult.AccessToken))
{ SubscriptionId = subscriptionId };
}

21
Q

How would you list all CDN profiles and endpoints?

A

private static void ListProfilesAndEndpoints(CdnManagementClient cdn)
{
// List all the CDN profiles in this resource group
var profileList = cdn.Profiles.ListByResourceGroup(resourceGroupName);
foreach (Profile p in profileList)
{
Console.WriteLine(“CDN profile {0}”, p.Name);
if (p.Name.Equals(profileName, StringComparison.OrdinalIgnoreCase))
{
// Hey, that’s the name of the CDN profile we want to create!
profileAlreadyExists = true;
}

    //List all the CDN endpoints on this CDN profile
    Console.WriteLine("Endpoints:");
    var endpointList = cdn.Endpoints.ListByProfile(p.Name, resourceGroupName);
    foreach (Endpoint e in endpointList)
    {
        Console.WriteLine("-{0} ({1})", e.Name, e.HostName);
        if (e.Name.Equals(endpointName, StringComparison.OrdinalIgnoreCase))
        {
            // The unique endpoint name already exists.
            endpointAlreadyExists = true;
        }
    }
    Console.WriteLine();
} }
22
Q

How do you create a CDN profile?

A

private static void CreateCdnProfile(CdnManagementClient cdn)
{
if (profileAlreadyExists)
{
//Check to see if the profile already exists
}
else
{
//Create the new profile
ProfileCreateParameters profileParms =
new ProfileCreateParameters() { Location = resourceLocation, Sku = new Sku(SkuName.StandardVerizon) };
cdn.Profiles.Create(profileName, profileParms, resourceGroupName);
}
}

23
Q

How do you create a cdn endpoint?

A

private static void CreateCdnEndpoint(CdnManagementClient cdn)
{
if (endpointAlreadyExists)
{
//Check to see if the endpoint already exists
}
else
{
//Create the new endpoint
EndpointCreateParameters endpointParms =
new EndpointCreateParameters()
{
Origins = new List<DeepCreatedOrigin>() { new DeepCreatedOrigin("Contoso", "www.contoso.com") },
IsHttpAllowed = true,
IsHttpsAllowed = true,
Location = resourceLocation
};
cdn.Endpoints.Create(endpointName, endpointParms, profileName, resourceGroupName);
}
}</DeepCreatedOrigin>

24
Q

How do you purge a cdn endpoint?

A

private static void PromptPurgeCdnEndpoint(CdnManagementClient cdn)
{
if (PromptUser(String.Format(“Purge CDN endpoint {0}?”, endpointName)))
{
Console.WriteLine(“Purging endpoint. Please wait…”);
cdn.Endpoints.PurgeContent(resourceGroupName, profileName, endpointName, new List<string>() { "/*" });
Console.WriteLine("Done.");
Console.WriteLine();
}
}</string>

25
Q

What is the difference between private and shared caching?

A

private caching: In-memory caching, fast
shared caching: caching inside of a shared server that applications pull from. guarantees data consistency, scalability.