Hi. I currently am self hosting on AWS ECS Fargate...
# agents
h
Hi. I currently am self hosting on AWS ECS Fargate. Its all good apart from the issue of when tasks are down scaling, some active sessions might get disrupted. What is a good work around for this? Shift to ECS with EC2 launch type? I want to stay self hosted so any advice within self hosting would be super appreciated!
p
If you increase the shutdown timeout, would that be good enough? I think the default is something between 30 and 120 seconds. So if you know how long each session take, you could use that. The downside is it would take longer to scale down and it doesn’t guarantee it won’t be terminated.
Another trick is to listen for the sigterm and mark your task as unhealthy (in your health check). Once the session completes, you go ahead and mark is as healthy again. In theory, ECS should only terminate it if it’s healthy.
h
As far as I know, 2 minutes is the hard stop. Or can you manipulate the sigterm signal like you are saying? If we can then I will try that. Please do confirm. I'll look into it then
@refined-appointment-81829 do you have any recommendations?
r
We do not recommend Fargate because ECS Fargate has a shutdown limit. EC2 is the proper method.
👀 1
h
Is ecs with ec2 launch type fine?
r
Yes
✅ 1
h
Using
c5.large
,
m5.large
is too much cost.. Isn't there any other recommended solution? This is not feasible for early stage start ups
r
I am not sure of all the AWS options.
b
Change the de-registration delay on the agents target group to 1 hour. What does this mean? This means once the new tasks are up and start taking traffic, the old tasks will go into a de-registration state. They will stay in that state for 1 hour. Meaning they will have 1 hour to finish their call!
✅ 1
r
@best-van-73181 Fargate does not support that.
h
I used ecs with ec2 and added drain_timeout in my worker. set stoptimeout in task definition larger than drain_timeout - works
r
Yes, from LiveKit perspective that is right. But in fargate they have a 120 second limit and will sjutdown the instance after that limit.
h
im using the ec2 launch type. the 120second limit does not affect that then