Quantcast
Channel: OpenStack and Cloud Thinking »李 滕
Viewing all articles
Browse latest Browse all 2

RabbitMQ in Nova [2]

$
0
0

Some background knowledge and simple usage about RabbitMQ, as well as its applicaiton in Nova is introduced in last article.We’ll continue to introduce some other topics about introduces RabbitMQ..

1. Why OpenStack choose RabbitMQ as message communications technology?

The candidates are:

MSMQ
The default choice for where only the products of Redmond are considered worthy. For my clients, if MSMQ can rise to the challenge, then they should use it. The main points against it are its lack of sophistication; nothing but send and receive; and it’s arbitrary hard limits, such as the 4MB maximum message size. However, with something like MassTransit or NServiceBus layered on top, it’s entirely possible to do serious work with it..

ActiveMQ
The stalwart of the Java world. It has long service and ubiquity going for it. It’s also cross platform and would provide a natural integration point for non-Microsoft platform products. However, it would have to perform better than MSMQ to have a look-in..

RabbitMQ
I’ve been hearing excellent things about this message broker written in Erlang. It supports the open AMQP (Advanced Message Queuing Protocol) with the potential to avoid vendor lock-in and benefiting from a wide range of clients in almost every language. AMQP provides some pretty sophisticated messaging patterns, so there’s less need for a MassTransit or NServiceBus. It also has ‘enterprise’ resilience and durability. That’s something my client is very interested in..

ZeroMQ
The company that created it were part of the AMQP group and had a product called OpenAMQ. ZeroMQ has a unique broker-less model which means that unlike all the other products under test, you don’t need to install and run a message queuing server, or broker. Simply reference the ZeroMQ library, it’s on NuGet, and you can happily send messages between your applications..

As you can see, there’s ZeroMQ and the others. Its performance is staggering. To be fair, ZeroMQ is quite a different beast from the others, but even so, the results are clear: if you want one application to send messages to another as quickly as possible, you need ZeroMQ. This is especially true if you don’t particularly mind loosing the occasional message. The reason that RabbitMQ is chosen because of its stability and high availability (Message persistence, Message confirmation).

2.  OpenStack Message Notification System

Openstack services(nova and glance) enables the system admin to get notification of events such as instance create,delete etc, called the noification system in openstack. The system is built based on RabbitMQ.

If you already have a openstack environment (if not you can try StackLab, for more information please click here.), You can do some simple test about Openstack notification system: 

The first thing you need to do is to modify the configuration file, add the following into nova.conf file:

notification_driver=nova.notifier.rabbit_notifier

Then restart the nova-compute service. Next, you can use the command “sudo rabbitmqctl list_queues” to check whether the queues sending notifications exists or not. In fact, you can write a script to intercept these notifications. They will be the most direct information to study the notification system. My program intercepted the following notification message intercepted when nova-compute creates a virtual machine:

on_create_start: 
{
	u'_context_roles': [u'admin'], 
	u'_context_request_id': u'req-2b737c31-4d94-422e-ba0f-e08e4a1a32c3',
	u'_context_read_deleted': u'no', 
	u'event_type': u'compute.instance.create.start', 
	u'timestamp': u'2012-09-07 02:43:01.354092', 
	u'payload': {
		u'state_description': u'scheduling', 
		u'display_name': u'0907008', 
		u'product_id': 99, 
		u'disk_gb': 0, 
		u'tenant_id': u'e621a64d7e824f7e936594e922c4e485',
		u'created_at': u'2012-09-07 02:42:54', 
		u'instance_type_id': 2, 
		u'instance_id': u'2d1b7c36-0c51-4ee6-ae48-29d5ff5a5ec7',
		u'instance_type': u'm1.tiny',  			   
		u'state': u'building', 
		u'memory_mb': 512, 
		u'user_id': u'7eb3e6642f57471b8da57ff7bc3617fe', 
		u'launched_at': u'', 
		u'image_ref_url': u'http://169.254.11.191:9292/images/cdca6dab-875d-4987-9f05-bb456bdce4b0'
		}, 
	u'_context_auth_token': None, 
	u'_context_is_admin': True, 
	u'_context_project_id': None, 
	u'_context_timestamp': u'2012-09-07T02:43:01.354111',
	u'_context_user_id': None,  					
	u'_context_remote_address': None, 
	u'publisher_id': u'compute.liteng-ThinkPad-E420', 
	u'message_id': u'2e65601b-eff4-4f57-ad5d-f96ada192566', 
	u'priority': u'INFO'
}

 

3. RabbitMQ components

The two core components of RabbitMQ’s are Exchange and Queues.

View RabbitMQ message queue on your machine using the command:

$ sudo rabbitmqctl list_queues

View the switch that RabbitMQ use to forward message on your machine using the command:

$ sudo rabbitmqctl list_ exchanges

Also, the command will list all the binding relationship of queues and switches :

$ sudo rabbitmqctl list_ bindings

(To be continued)

Reference: http://www.aqee.net/message-queue-shootout/

Author:
Lee Teng, Intern System Develop Engineer of Sina SWS.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images