[rabbitmq-discuss] PubSub - all bindings have to be in memory?

Matthew Sackman matthew at lshift.net
Mon Feb 1 13:43:15 GMT 2010

Hi Ben,

On Mon, Feb 01, 2010 at 07:58:52AM +0200, Ben Browitt wrote:
> Do I have to keep all bindings in memory or is there a mode where rabbitmq
> can read binding keys from disk when needed?

I'm afraid bindings are all kept in RAM. The binding record is quite
small (dependent on the size of the exchange name, binding key, queue
name and any args - minimising these will help reduce memory foot print)
so you should be able to fit quite a lot of them in RAM:

> erts_debug:flat_size(#binding{exchange_name = <<"my_exchange">>, queue_name = <<"my_queue">>, key = <<"my_key">>, args = []}).

So just 24 bytes for that record, though obviously with padding and
longer field values, this will grow. Fixed size values here would help -
if for example you're able to use md5sums to get the exchange name and
queue name, and only use fanout or direct exchanges, and thus have an
fixed sized hash for the binding key too, then that'll make estimations

If you can estimate given, say, twice your expected number of visitors
and twice the expected number of articles they subscribe to how many
bindings that would result in, then you may be able to satisfy yourself
whether or not this is going to be a problem.

Whilst the new persister is able to page messages out to disk, we have
no plans just at the moment to be able to do the same for bindings.

Please let us know how you get on.


More information about the rabbitmq-discuss mailing list