Does Nomad in combination with Consul supports the termination of services after certain time of inactivity. Inactivity is defined here as no requests have been passed to the service. What would be the best approach to handle that outside the service itself?
Asked
Active
Viewed 46 times
1 Answers
0
One possibility would be to use the Nomad autoscaler to scale your application up and down based on metrics. In your case those metrics would be number of requests going into the service.
If you set minimum count to 0, it should then scale down to 0 when there are no requests going to the service.
I have a demo that shows scaling on prometheus metrics. By changing the scaling query to use requests per second to the application instead (like here you should get your desired result.
If you are already using consul connect to link up the services, this demo should contain everything you need to do it.

Erik Veld
- 11
- 4