Removing Idle State in Service Cloth
I have a set of custom stateful services that serve requests made using a stateless service (web API) open source in an application.
I am trying to remove a state service if it is not serving any user request from a certain interval of time, say an hour. I currently manage this by storing a .NET timer in the service itself and using the tick event to self-destruct the service if it was idle.
Is it the right thing to do? Or is there any other more efficient approach for doing this in an Azure service?
source to share
The mechanism you have will work great and this is what we usually recommend.
Another way to do this is to have a generic "Service Manager" service that is periodically checked to make sure services are busy (or have been informed), and which might trigger a call to deleteeserviceasync. Thus, this service only needs cluster administrator rights, and all others can be read-only locked.
source to share