# DistributedPubSubMediator - Horizontal scalability?

**URL:** https://discuss.akka.io/t/distributedpubsubmediator-horizontal-scalability/5747
**Category:** Akka Libraries
**Tags:** akka-cluster
**Created:** [January 15, 2020, 11:18pm UTC](https://discuss.akka.io/t/distributedpubsubmediator-horizontal-scalability/5747 "2020-01-15T23:18:51Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![stephen-lane](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/stephen-lane/32/1728_2.png) [@stephen-lane](https://discuss.akka.io/u/stephen-lane)
#### Post date: [January 15, 2020, 11:18pm UTC](https://discuss.akka.io/t/distributedpubsubmediator-horizontal-scalability/5747/1 "2020-01-15T23:18:51Z")

</div>

Hi Folks,

Thanks in advance for reading my topic,

Im looking at the akka DistributedPubSubMediator, and it would be perfect for my use case, except i’m not sure about its horizontal scalability. In the doco, it says that the pub/sub registry is shared via the gossip protocol between all akka nodes. In a scenario with many small pub/sub channels (i.e one or two subscribers for each topic) this doesn’t seem scalable.

If there are millions of pub/sub channels with millions of subscribers across across several nodes, will it reach a point where adding extra nodes will not add extra capacity due to having to replicate the same pub/sub registry across all nodes?

---

<div class="post-metadata">

### Author: ![patriknw](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/patriknw/32/89_2.png) [@patriknw](https://discuss.akka.io/u/patriknw)
#### Post date: [January 16, 2020, 1:27pm UTC](https://discuss.akka.io/t/distributedpubsubmediator-horizontal-scalability/5747/2 "2020-01-16T13:27:24Z")

</div>

It’s not intended for millions of topics and would not work well for frequently created short lived topics.

> [@stephen-lane](#):
>
> If there are millions of pub/sub channels with millions of subscribers across across several nodes, will it reach a point where adding extra nodes will not add extra capacity due to having to replicate the same pub/sub registry across all nodes?

Yes, that is correct.

You need to create some intermediate level of less and stable number of topics running on each node and then perform more fine grained filtering to final destinations locally on each node.

---

<div class="post-metadata">

### Author: ![stephen-lane](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/stephen-lane/32/1728_2.png) [@stephen-lane](https://discuss.akka.io/u/stephen-lane)
#### Post date: [January 16, 2020, 3:02pm UTC](https://discuss.akka.io/t/distributedpubsubmediator-horizontal-scalability/5747/3 "2020-01-16T15:02:34Z")

</div>

Excellent, thank you for the explanation, I hadn’t previously though about the solution of having a course grained topic for pub/sub, then filtering down within the local node.
