简体   繁体   中英

Is it okay to do a service that query Azure Cosmos DB every minute?

I am planning to make a reminder feature for a chatbot. The bot will ask the user and a reminder subject and DateTime will be saved to Cosmos DB.

What I am thinking is making that service will query/check the database every minute to see if a DateTime matches the current DateTime and then send a proactive chat to the user if it matches. (I am thinking of azure function for this? or an infinite loop inside C#?)

My question is, will the payment for Azure Cosmos DB shoot up if I am to make a service that queries from Cosmos DB every minute? Is it wise to do this? Is there a better/alternate method to make a reminder feature for a chatbot?

To answer you question "will the payment for Azure Cosmos DB shoot up if I am to make a service that queries from Cosmos DB every minute?"

Once you've fed your Cosmos DB container with some relevant data — that could be test data to start with — you can use the query explorer that's available from the Azure portal. Besides helping you build and debug your SQL queries, this tool also reports the real cost of those queries.

So yes , it will increase the consumption so is billing.

Here is something which you can use :

  • Store all your reminders in database.
  • If it's not too many which i am guessing ,won't be the case, store in some kind of cache or in-memory.
  • Start the timer and keep tracking ticks, give a alert for any upcoming event , and you can manage the state too for the same object or you can send a event in queue. Update the event status after getting notification from queue.

In this way , cost would be optimized.

Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM