I got a conceptual puzzle converting my app from a classic service to a microservice. I need to count total number of open sessions.
My classic version was writing a local windows perf counter: +1 on session open, -1 on session close. If the service died unexpectedly, the new instance reset the counter during start. A remote monitoring service was collecting the counter from all instances and showing total and average.
My new service writes counters using diagnostics library that pushes the values to a remote monitoring service.
I do not understand how to reset the counter if the service dies unexpectedly. The only idea I got is to start collecting heartbeats from each service and reset the counter if the service dies, but it seems to be over-design.
Are there more elegant patterns to do a reliable accounting for open sessions for a stateless service?
Aucun commentaire:
Enregistrer un commentaire