Consumer retrieve data from the queue when they are ready
Producers don’t need to know anything about the identity or number of consumers
Consumers don’t need to know who producers are and where the work came from
This pattern enables:
code to be decoupled from each other
behavior to be coupled indirectly through the work queue
Performance
If the producers don’t generate work fast enough to keep the consumers busy, the consumers just wait until more work is available
Good in Server application, waiting for client requests
Bad in application where effectively infinite work needs to be done, like web crawler, Producer/Consumer ratio of threads need to be adjusted
If producers consistently generate work faster than the consumers can process it, eventually the application will run out of memory because of queue size