I was reading Google's Architectural overview of Pub/Sub and I was curious how publisher and subscription servers were connected.
From what I understand:
- When a message is published, it is stored, and then once all subscriptions have acknowledged that message is deleted.
- subscription servers can use a pull or push model
- if a client was not connected and "wakes up" hours after a message was published, it can "pull" the publisher server for messages that it missed.
I can imagine that subscription servers are connected to publisher servers via websocket (or some sort of long polling) but if EVERY subscriber server is connected to EVERY publisher for EVERY topic, that's a LOT of connections.
Two questions:
- So I'm curious if anyone has insight as to how this is done internally at Google's PubSub?
- How do subscription servers know which publisher servers to connect to? There could be a map of topic <-> publishers, but If I send a message now on a publisher and the publisher is killed a few minutes later then the publisher will no longer be in the map.
Thanks in advance