Message queues study

https://blog.csdn.net/qq_43154385/article/details/89011224

To a popular personal interpretation of it.
Message queue, the queue is a first name suggests.
There operation queue 入队and出队

Do you have a program that is generating content and then into the team (producer)
another program reads the content, the content team (consumers)

This is the most basic concepts.

I think you should use is the lack of a scene.

When you do not get the results immediately, but concurrency can not infinite, pretty much you need to use when the message queue.

For example, you write the log, because there may be a client has multiple operations to write, there are a lot of clients, concurrent obviously not infinite, so you will need to log into the write request to the message queue, the consumer side in order to generate the log queue writes database.

As for how to implement message queues, in fact, you own an ordinary queue line ah ~ to see what additional features you need it.

Technical issues are resolved, the message queue is to solve a lot of unexpected request into a request queue back end could take, such as your server can handle 100 orders for one second, one second spike activity but come 1000 orders, continued 10 seconds, in the case of the back-end capacity can not be increased, you can use the message queue a total of 10,000 requests in the queue pressure, according to the original background consumer handling ability, after 100 seconds finished processing all the requests (rather than directly down missing order data)

Find the data structure to see this book, the queue is a data structure, an array or linked list internally implemented, the characteristics of the queue is placed in a head-only, the tail removed, i.e., FIFO, producing specific applications facie by consumers;

In layman's terms, is a container, you throw into the news, does not require immediate attention. Then there is a program to read to you from the inside out a section of the container message processing.
Message Queuing, can be activeMQ, kafka the like, or may be a task table of the database.

 

 

Producer data into the message queue, the message queue data, and consumers get the initiative to call (commonly known as push)

Consumers continue to go in rotation message queue, see if there is new data, if you consume (commonly known as pull)

Guess you like

Origin www.cnblogs.com/cherishforchen/p/11297632.html