Search code examples
autobahncrossbarwamp-protocol

Memory consumption of Crossbar retained events


self.publish('foo.%s' % id, 'bar', options=PublishOptions(retain=True))

When using retained events, what's the memory consumption behaviour on the Crossbar router? Is the event stored forever, or is it purged after some time and the memory reclaimed?

I'm using wildcard topics, so there will be an ever growing backlog of retained events, unless old topics/retained events are purged at some point.


Solution

  • For full-on event history, you can configure the memory usage (https://crossbar.io/docs/Event-History/) but for retained events only the latest event for a topic is retained.

    By "wildcard topics" you mean that you're publishing to foo.<something> and so there'll be an unbounded number of topics you're publishing to?

    I can see two solutions (both require changes to Crossbar): add a Meta API to expire/remove particular retained events, or add some configuration option(s) to crossbar to limit retention somehow (maybe by time, maybe by number of events)?

    Another solution if it works for your use-case would be to make the "topic" a fixed URI and add the ever-changing part ("id") as one of the arguments; then you could either use "retain" for just the latest one or use the "event history" feature if you want to keep a certain number around.