2019 rabbitMQ high-frequency interview questions (java)

Foreword

2019 will soon be over, with us is about to usher in the new year, the Spring Festival, once again usher in a new interview gold and three silver four seasons. Then, as the program you apes, really be prepared for it, also, or content with their jobs, continue to do the things at hand.
Of course, no matter how you choose, if you're really ready to quit after gold and three silver four, then as a Java engineer, may not be read. How in a few months time, rapid adequately prepare it for the upcoming interview?

1. RabbitMQ usage scenarios What?

Buying activities, load shifting, to prevent system collapse.


Delay information processing, such as sending e-mail alert to a single non-payment of the user 10 minutes.


Decoupling system for new features can write a separate module expansion, such as user confirmation after evaluation, adds functionality to the user points back, this time without adding new features integrated in the business code, just need to add message queue Interface subscription confirmation to the evaluation of the integral, then later add any functionality only to subscribe to the message queue.

What are the important roles 2. RabbitMQ there?

RabbitMQ have an important role: producers, consumers and agents:

Producer:

The message creator, responsible for creating and push data to the message server;

consumer:

Recipient of the message, for processing data and an acknowledgment message;

proxy:

RabbitMQ is itself, for playing the role of "express" itself does not produce a message, just play the role of "Express" is.

What are the important components 3. RabbitMQ there?

The ConnectionFactory (connection manager): application establishes a connection between the manager and the Rabbit, the program code used.

Channel (Nobumichi):

Push message channels used.

Exchange (switch):

For receiving, allocation message.

Queue (queue):

Storing a message producer.

RoutingKey (routing key):

The data generator for assigning to the switch.

BindingKey (key bindings):

It used to switch on the queue of messages bound.

What is the role 4. RabbitMQ in vhost is?

vhost: Each RabbitMQ can create a lot vhost, we call virtual hosts, each virtual host are actually mini version of RabbitMQ, it has its own queue, switches and bindings, have their own rights mechanisms. He can also be understood as the concept of a database.

5. RabbitMQ is how to send the message?

First, the client must connect to RabbitMQ server to publish and consume messages, will create a tcp connection between the client and rabbit server, once tcp open and certified (certification that you sent to the user name and password rabbit server), you the client and RabbitMQ created a amqp channel (channel), the channel is to create a virtual connection in the "real" tcp, and amqp commands are through channel sent out, each channel will have a unique id, whether it is released message, the subscription queue are completed through this channel.

6. RabbitMQ how to ensure the stability of the message?

It provides functionality affairs.

By setting the channel to confirm (acknowledgment) mode.

7. RabbitMQ how to avoid message loss?

The message is persistent disk, restart the server to ensure that messages are not lost.

Each cluster has at least one physical disk, the disk falls guaranteed message.

8. To ensure the success of conditional message persistence What?

Statement queue must be set to persist durable set to true.

Push message delivery persistent mode must be set, deliveryMode set to 2 (persistent).

Message has arrived persistent switch.

Message has arrived persistent queue.

These four conditions are met in order to ensure the message persistence to succeed.

9. RabbitMQ persistence What are the disadvantages?

Persistent lack of land is to reduce the throughput of the server because of a disk instead of using memory storage, thereby reducing throughput. Ssd hard drive can make use of to alleviate the problem of throughput.

10. RabbitMQ There are several types of broadcast?

direct (default):

The simplest most basic mode, the sender sends a message to subscribers, if there are multiple subscribers, taking the default polling way messaging.

headers:

And direct similar, but poor performance, almost less than this type.

fanout:

Distribution model, the consumer distributed to all subscribers.

topic:

Matching subscription model, then matched to a regular message queue can be matched to the can receive.

11. RabbitMQ how to achieve delayed message queue?

Delay queue achieved in two ways:

By entering the dead letter message expires switch, and then forwarded by the switch to the consumer queue delay, to achieve a delay function;

Use RabbitMQ-delayed-message-exchange plug-in implementation delay function.

12. RabbitMQ cluster what's the use?

Clustered mainly in the following two purposes:

High Availability:

A server problem, the entire RabbitMQ can continue to use;

high capacity:

Clusters can carry an amount of more messages.

13. RabbitMQ node type what?

Disk node:

Messages are stored to disk.

Memory node:

Messages are stored in memory, restart the server message loss, higher performance than disk type.

14. RabbitMQ cluster to build what issues need attention?

Used between nodes "-link" connection, this attribute can not be ignored.

erlang cookie value of each node must use the same, this value corresponds to the "keys" function for authenticating each node.

The entire cluster must contain a disk node.

15. RabbitMQ is a complete copy of each node to other nodes do? why?

No, for two reasons:

Storage space considerations:

If each node has a complete copy of all the queues, so not only does not add nodes to add storage space, but adds more redundant data;

Performance considerations:

If you need a complete copy of each message to each cluster node, the new node that does not improve the ability to handle messages up to maintain the same performance of a single node or even worse.

16. RabbitMQ cluster nodes only one disk crashes What happens?

If the only disk disk node crashes, can not do the following:

You can not create a queue

You can not create exchanger

You can not create a binding

You can not add users

You can not change the permissions

You can not add and remove cluster nodes

The only disk node crashes, the cluster can be kept running, but you can not change anything.

17. RabbitMQ cluster nodes required by the order to stop it?

RabbitMQ cluster stop order is required, it should turn off the memory node, and finally close the disk nodes. If the order is just the opposite, it may cause loss of messages.

Public concern ape Society program number, reply the keyword "interview" to get face questions zk, dubbo, springboot, springcloud, mybatils, apollo and other technologies.

 

Public number: ape Society program

Real-time updates weekly

Guess you like

Origin www.cnblogs.com/myworked/p/12123266.html