1.8 Cache Flashcards

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

What is caching?

A

Caching improves page load times and reduces the load on servers and databases.

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

What does the dispatcher do in caching?

A

The dispatcher looks up if the request has been made before and returns the previous result.

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

How do databases benefit from caching?

A

Databases benefit from a uniform distribution of reads and writes across partitions.

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

What can cause bottlenecks in database performance?

A

Popular items can skew distribution, causing bottlenecks.

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

What is client caching?

A

Caches located on the client side (OS or browser), server side, or in a distinct cache layer.

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

What is CDN caching?

A

CDNs are considered a type of cache.

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

What is web server caching?

A

Reverse proxies and caches like Varnish can serve static and dynamic content directly.

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

What is database caching?

A

Databases usually include some level of caching in a default configuration optimized for generic use cases.

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

What is application caching?

A

In-memory caches like Memcached and Redis are key-value stores between the application and data storage.

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

What is a characteristic of in-memory caches?

A

Data held in RAM is much faster than data stored on disk.

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

What is cache invalidation?

A

Cache invalidation algorithms like least recently used (LRU) help invalidate ‘cold’ entries and keep ‘hot’ data in RAM.

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

What additional features does Redis have?

A
  • Persistence option
  • Built-in data structures such as sorted sets and lists
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are the two general categories of caching levels?

A
  • Database queries
  • Objects
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are some suggestions of what to cache?

A
  • User sessions
  • Fully rendered web pages
  • Activity streams
  • User graph data
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is cache-aside?

A

The application is responsible for reading and writing from storage, resulting in a cache miss that loads entry from the database.

17
Q

What is a disadvantage of cache-aside?

A

Each cache miss results in three trips, causing a noticeable delay.

18
Q

What is write-through caching?

A

The application uses the cache as the main data store, reading and writing data to it, while the cache manages the database.

19
Q

What is a disadvantage of write-through?

A

When a new node is created due to failure or scaling, it will not cache entries until the entry is updated in the database.

20
Q

What is write-behind (write-back)?

A

The application adds/updates entry in the cache and asynchronously writes to the data store.

21
Q

What is a disadvantage of write-behind?

A

There could be data loss if the cache goes down before its contents hit the data store.

22
Q

What does refresh-ahead caching do?

A

It automatically refreshes recently accessed cache entries prior to expiration.

23
Q

What is a disadvantage of refresh-ahead?

A

Not accurately predicting needed items can lead to reduced performance.

24
Q

What is a key challenge in caching?

A

Maintaining consistency between caches and the database through cache invalidation.