Cost of running a chatbot
04/14/2018
2 minutes
I have been using bot framework to run an unpublished chatbot. My chatbot is unpublished, as it is only used by a handful of people for testing purposes. As of end of last year, bot framework went live, and depricated the previous way to store the bot's state. we need to provide a way to manage data state, we can implement IBotDataStore
, or just simply use one of the provided solutions. I went by using the latter option, using the CosmosDB. The reason was that I wanted to take a closer look at Cosmos DB, which has great features. After a couple of months I took a look the detailed costs in my bill, and I was striked me by the fact, that CosmosDB is expensive for a chatbot being a test phase.
A pre-tax of nearly 50 Euros seems quite high for an unpublished chatbot having a couple of requests a day.
I changed to table store instead, it meant to give another implementation to IBotDataStore
:
var connectionString = "DefaultEndpointsProtocol=https;Accou..." var store = new TableBotDataStore(connectionString); builder.Register(c => store).Keyed<IBotDataStore>(AzureModule.Key_DataStore).AsSelf().SingleInstance(); builder.Register(c => new CachingBotDataStore(store, CachingBotDataStoreConsistencyPolicy.ETagBasedConsistency)).As<IBotDataStore>().AsSelf().InstancePerLifetimeScope(); builder.Update(Conversation.Container);
Promptly my costs went down to nearly 0 Euros with the Storage Account, and the Cosmos DB could have been deleted (unless you prefer to migrate your data, which you would in a production application).
The picture below shows: half month usage with CosmosDB, and a half month usage with the Storage Account:
To note, there is a third built in option to store the state, the InMemory solution, but this shall be used only for development purposes as it is not persistent.