Connection and Performance Optimization in DirectConnect Data Streams

Setting up a DirectConnect data stream establishes a real-time connection to your database. Each time an entity that uses dimensions or measurements sourced from DirectConnect is loaded, your database is queried in real time. A real-time connection can potentially result in many calls being made to your database concurrently, leading to slower performance and exceeding rate limits.

Use the data stream’s cache functionality to improve performance and temporarily save each query result for the defined cache duration. Whenever you load the same entity, the data is retrieved from the cache, rather than making an additional call to the external database.

Salesforce recommends setting the cache duration based on how frequently your database is updated. For example, set the cache duration to 20 minutes if the database updates every 20 minutes. Setting to any amount of time less than 20 minutes, can result in no data retrieval.

caching duration