1.9 Asynchronism Flashcards

1
Q

What is the purpose of asynchronous workflows?

A

To reduce request times for expensive operations and perform time-consuming work in advance

Examples include periodic aggregation of data.

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

What do message queues do?

A

Receive, hold, and deliver messages.

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

Describe the workflow of using a message queue.

A

An application publishes a job, notifies the user, a worker processes the job, and signals completion.

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

What happens to the user during the processing of a job in a message queue?

A

The user is not blocked and may do a small amount of processing.

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

What is an example of a task that might be processed in the background using a message queue?

A

Posting a tweet.

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

What is a disadvantage of using Redis as a message broker?

A

Messages can be lost.

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

What protocol must you adapt to when using RabbitMQ?

A

‘AMQP’ protocol.

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

What is a potential drawback of Amazon SQS?

A

High latency and possibility of messages being delivered twice.

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

What do task queues do?

A

Receive tasks, run them, and deliver results.

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

What type of jobs can task queues support?

A

Computationally-intensive jobs.

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

What is a key feature of Celery?

A

Support for scheduling and primarily Python support.

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

What is back pressure in the context of queues?

A

A mechanism to limit queue size to maintain high throughput rate.

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

What happens when queues grow larger than memory?

A

Results in cache misses, disk reads, and slower performance.

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

What status code do clients receive when the queue is full?

A

Server busy or HTTP 503 status code.

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

What is a potential drawback of asynchronism?

A

Can add delays and complexity.

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

In what scenarios might synchronous operations be better suited?

A

Inexpensive calculations and realtime workflows.

17
Q

What is Little’s law related to?

A

Queueing theory.

18
Q

What is the difference between a message queue and a task queue?

A

A message queue holds messages for processing, while a task queue receives tasks and their data for execution.