Reputation: 274
Is it a good practice for ECS tasks to stop after a week or month in order to avoid problems that can result from tasks that have been running for a long time?
My team has had issues with the host that a task is using running out of memory or the authorization proxy dying on the host which causes database queries to fail. I thought a potential solution would be to have multiple tasks running and for each task to automatically stop after several days. We have found solutions to the memory issue, but the authorization proxy problem remains. There would also be other problems in the future. Ideally we would avoid them permanently, but is it standard to avoid these issues by not letting the tasks run for very long?
Upvotes: 0
Views: 1223
Reputation: 1897
Tasks are for temporary "tasks" that are expected to end at some point. They're for automation scripts or temporary development sites.
It sounds like a "Service" is what you really want, which is the same thing as a Task except it is intended to keep running forever, and can be configured to auto-restart on failure.
That being said, if your application is crashing on its own, making it a Service will not fix that but it will at least automatically restart it whenever it crashes. The crash from your application running out of memory is a different issue and may be a bug in your code.
Upvotes: 1