Convox Community

Enabling swap on a service

Right now the memory limits appear to be hard limits before the service container is killed. I see that in https://github.com/aws/containers-roadmap/issues/322 ECS supports swap now. I also see in the ECS task definition it looks like there is a spot for soft memory limits instead of hard limits but I don’t see a way to do that on Convox.

I have a service that usually stays within a 256MB limit, but occasionally on large render jobs goes above that. I can always just increase the memory limit, but it looks like doing that will slow down the majority of jobs by having fewer services/EC2 instance. I would rather just let the few larger jobs run a little slower via using the swap if they go above that limit instead of hard crashing. It is also going to be a continual game of wack a mole to guess what the largest job will ever be since it is left up to customers to design as complex pages as they want.

Anyone know anything about how this works? From everything I can see Convox should already have swap enabled. When logging into an instance I can see that there is swap available:

              total        used        free      shared  buff/cache   available
Mem:           1955         472         195           0        1287        1343
Swap:          5119         117        5002

But when I actually try to run a single job that I know will use more then the 256MB limit, the container will get hard killed by ECS the second the container goes over the memory limit. Is there something special I need to do to allow the container to actually use swap without getting killed by ECS?

I actually have had the opposite problem - certain services swapping when I would rather they be killed.

What’s your SwapSize rack parameter?

https://docs.convox.com/reference/rack-parameters#swapsize

I just checked and it is the default of 5 still. Are you running the latest rack?