I know, with AWS Lambdas, you really can't start long-running tasks in the background, for a variety of reasons. I've seen indications that App Runner might be slightly better at that sort of thing. But I haven't been able to find documentation about the details of App Runner instance shutdowns.
Suppose when responding to a request, an ASP.NET Core app queues up a background task which might take up to a minute to complete, and then the app returns a response to the original request.
Now suppose App Runner starts scaling down this application: it stops sending new requests to the instance it has selected to shut down. After all the current requests have finished, does App Runner send a command to invoke IHostedService CancellationTokens? If so, how long a grace period is the application given to complete before it gets forcefully shut down?
Does App Runner use the same strategy used by ECS, where it sends a SIGTERM
, waits a period of time, and sends a SIGKILL
to the app? If so, is that period of time configurable?