3

I was testing mesos cgroups isolation. To see what kind of error gets thrown. I ran the below shell program with marathon. Assigned 1 MB memory and 1 CPU.

 #!/bin/sh

temp=a
while :
do
    temp=$temp$temp
    echo ${#temp}
    sleep 1
done

A single character takes 1B of space so the program above needs to throw an exception once the length of the temp string reaches about 1 MB. But the tasks seem to get killed randomly. The task sometimes gets killed at length 1048576 or 2097152 or 4194304. Ideally since 1MB is the limit it should have stopped when length is 524288.

Additional info - Slave is run with --isolation='cgroups/cpu,cgroups/mem' Mesos version - 0.25

V.G
  • 113
  • 1
  • 2
  • 8

1 Answers1

1

The variance you are seeing can be explained with the following:

  • The amount of memory taken up by your script is not entirely deterministic, as it depends on the implementation of the shell interpreter as well as the size of your system's shared libraries (i.e. the parts of those libraries loaded into your program's resident set).
  • A 1 MB task in Mesos is accompanied 32 MB for the executor. Because the executor requires slightly less than 32 MB, you will have slightly more than 1 MB for your task.
Joseph Wu
  • 26
  • 3