Topic cache
A unique feature of Diffusion® Cloud’s Pub/Sub is its last value cache.
By default, topics in Diffusion® Cloud store their most recent value in memory.
When a client first subscribes to a topic, it is sent the latest value of the topic.
This means that new connections don’t need to wait for the next update before receiving useful data.
Automatic deltas
A key benefit of retaining the latest value for topics is that it lets Diffusion® Cloud drastically optimise the amount of data it needs to deliver.
When Diffusion® Cloud receives an update for a topic, it:
-
compares the new value against the previous one, and
-
only sends the differences in data to each subscriber.
Diffusion® Cloud Client SDKs automatically reconstruct the full value from these deltas.
This means that your application sends and receives whole messages, but the bandwidth needed to deliver your data can be significantly reduced.
You can also turn off the automatic delta feature for a topic by setting the PUBLISH_VALUES_ONLY
property for a topic. This may increase performance where there are substantial differences between one value of the topic and the next value. For example, unstructured binary data such as images does not benefit from deltas.
Application state
Topic state can be retained indefinitely, is fully replicated, and is persisted to disk. This ensures availability of data and enables you to treat Diffusion® Cloud like a real-time data cache, where your application can send stateless events and store persistent application state all through the same platform.
If your application does not require retaining state for a topic, you can use the DONT_RETAIN_VALUE
topic property to disable the last-value cache entirely.