Giter Club home page Giter Club logo

internals's Introduction

RabbitMQ Internals

This project aims to explain how RabbitMQ works internally. The goal is to make it easier to contribute for newcomers to the project, and at the same time have a common repository of knowledge to be shared across the project contributors.

Purpose

Most interesting modules in RabbitMQ projects have documentation essays, sometimes quite extensive, at the top. The aim here is not to duplicate what's there, but to provide the highest-level overview as to the overall architecture.

Guides

In order to understand how RabbitMQ's internals work, it's better to try to follow the logic of how a message progresses through RabbitMQ as it is handled by the broker, otherwise, you would end up navigating through many guides without a clear context of what's going on, or without knowing what to read next. Therefore we have prepared the following guides to help you understand how RabbitMQ works:

Basic Publish Guide

Here we follow the life of a message since it's received from the network until it has been routed by the exchanges. We take a look at the various processing steps that happen to a message right until it is delivered to one or perhaps many queues.

Basic Publish

Deliver To Queues Guide

After the message has been routed, the broker needs to deliver that message to the respective queues. Here not only the message has to be sent to queues, but also mandatory messages and publisher confirms need to be taken into account. Also, the queue needs to try to deliver the message to prospective consumer, otherwise the message ends up queued.

Deliver To Queues

Queues and Message Store

Provides an overview of the Erlang processes that back queues and how they interact with the message store, message index and so on.

Queues and Message Store

Variable Queue Guide

Ultimately, messages end up queued at the backing queue. From here they can be retrieved, acked, purged, and so on. The most common implementation of the backing queue behaviour is the rabbit_variable_queue module, explained in the following guide:

Variable Queue

Mandatory Messages and Publisher Confirm Guides

As explained on the Deliver To Queues guide, a channel has to handle messages published as mandatory and also take care of publisher confirms. These processes are explained in the following guides:

Authentication and Authorization

As explained in the Basic Publish, there are some rules to see if a message can be accepted by the broker from a certain publisher. This is explained in the following guide:

Authorization and Authentication Backends

Internal Event Subsystem

In some cases components in a running node communicate via events. Some events are consumed by other nodes.

Internal Events

Management Plugin

An architectural overview of the v3.6.7+ version of the management plugin.

Metrics and Management Plugin

Maturity and Completeness

These guides are not complete, haven't been edited, and are work in progress in general.

So if you find yourself wanting more detail, check the code first!

License

(c) Pivotal Software Inc, 2015-2016

Released under the Creative Commons Attribution-ShareAlike 3.0 Unported license.

internals's People

Contributors

acogoluegnes avatar binarin avatar camelpunch avatar ddelapaz avatar dumbbell avatar essen avatar ethagnawl avatar gjaldon avatar gomoripeti avatar kjnilsson avatar kulte avatar lukebakken avatar michaelklishin avatar spring-operator avatar videlalvaro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

internals's Issues

Possible typo in the `networking_and_internals` document

Under the "Messaging and Protocol Listeners" section, we see the line:

"rabbit_networking:boot_tcp/0 and rabbit_networking:boot_tcp/0 start plain TCP and TLS listeners, respectively."

I don't think boot_tcp is supposed to be referenced twice there. The rabbit_networking module in rabbitmq-common has boot_tcp method and boot_ssl methods; I think that boot_ssl is the other one that needs to be referenced.

What is the advantage of Rabbitmq's backingqueue mechanism?

BackingQueue is a complicated mechanism , I don't know how does it come out and what's its advantages . I can figure out an easier approach of doing message swapping between RAM and disk , consider this :

preconditions :

* the data structure of messages in RAM is a linked list , like m1->m2->m3 . Each of `mx` is a structure contains meta data(not the content) of the message ,and links to the next `mx`.
* There is a limit  number of messages in RAM , says 5 . 

producing process

1. Producer continues pushing messages into the queue ,message sequence is [1,2,3,4,5] , until the queue is filled like  `m5(tail)<-->m4<-->m3<-->m2<-->m1(head)`
2. Now, reach the limit , swap 1/2 of messages onto the disk ,starting from the tail . Then , m5 and m4's content are no longer in RAM , they are now on the disk .
3. Push m6 and m7 into the queue. 
4. Trigger the limit condition, back to step2 ..

consuming process

1. consuming from m1 to m5 , whenever find a message that its content is on the disk instead of RAM , load the message and its adjacent neighbours  into RAM .

The above way doesn't consider the RAM occupied by the message meta data ( index's counterpart in BackingQueue ) , since it could probably be small enough .

So , what's the advantages of BackingQueue can bring ? Not just compared to my way , but also how it comes out?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.