Home > Software design >  Azure Cosmos DB - any downside of using very low TTL for health check items?
Azure Cosmos DB - any downside of using very low TTL for health check items?

Time:11-05

As part of the health checks that we have implemented for an app, we are attempting to write a dummy document to the database. For this document, we are using a TTL (time-to-live) of 10 seconds, so that Cosmos DB automatically cleans up the document.

My question is: Is there a downside (performance, RU cost, etc.) of setting the TTL all the way down to 1 second? As soon as the document was successfully written, the health check is happy and we don't care about the document anymore.

CodePudding user response:

There is no downside, performance degredation or extra cost assocuiated to the setting of low TTL. If you look at this documentation HERE. It states.

Deletion of expired items is a background task that consumes left-over Request Units, that is Request Units that haven't been consumed by user requests. Even after the TTL has expired, if the container is overloaded with requests and if there aren't enough RU's available, the data deletion is delayed. Data is deleted once there are enough RUs available to perform the delete operation. Though the data deletion is delayed, data is not returned by any queries (by any API) after the TTL has expired.

  • Related