Topic cache

A unique feature of Diffusion®'s Pub/Sub is its last value cache.

By default, topics in Diffusion® 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® drastically optimise the amount of data it needs to deliver.
When Diffusion® receives an update for a topic, it:

  1. compares the new value against the previous one, and

  2. only sends the differences in data to each subscriber.

Diffusion® 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® 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.