1.9 Asynchronism Flashcards
What is the purpose of asynchronous workflows?
To reduce request times for expensive operations and perform time-consuming work in advance
Examples include periodic aggregation of data.
What do message queues do?
Receive, hold, and deliver messages.
Describe the workflow of using a message queue.
An application publishes a job, notifies the user, a worker processes the job, and signals completion.
What happens to the user during the processing of a job in a message queue?
The user is not blocked and may do a small amount of processing.
What is an example of a task that might be processed in the background using a message queue?
Posting a tweet.
What is a disadvantage of using Redis as a message broker?
Messages can be lost.
What protocol must you adapt to when using RabbitMQ?
‘AMQP’ protocol.
What is a potential drawback of Amazon SQS?
High latency and possibility of messages being delivered twice.
What do task queues do?
Receive tasks, run them, and deliver results.
What type of jobs can task queues support?
Computationally-intensive jobs.
What is a key feature of Celery?
Support for scheduling and primarily Python support.
What is back pressure in the context of queues?
A mechanism to limit queue size to maintain high throughput rate.
What happens when queues grow larger than memory?
Results in cache misses, disk reads, and slower performance.
What status code do clients receive when the queue is full?
Server busy or HTTP 503 status code.
What is a potential drawback of asynchronism?
Can add delays and complexity.
In what scenarios might synchronous operations be better suited?
Inexpensive calculations and realtime workflows.
What is Little’s law related to?
Queueing theory.
What is the difference between a message queue and a task queue?
A message queue holds messages for processing, while a task queue receives tasks and their data for execution.