That's very useful, thank you! Aaron
________________________________ From: Ian Downes [[email protected]] Sent: 21 May 2015 18:20 To: [email protected] Subject: Re: How slaves calculate resources You can specify the resources a slave should offer using the --resources flag. If unspecified, the slave determines ("guesses") appropriate values. For memory it will call os::memory() as Alexander stated and, assuming memory is at least 2 GB then it will leave 1 GB for the system and offer the rest, i.e., memory - 1 GB. If memory is less than 2 GB it will offer 50%. The relevant code from slave/containerizer/containerizer.cpp is: if (!strings::contains(flags.resources.get(""), "mem")) { // No memory specified so probe OS or resort to DEFAULT_MEM. Bytes mem; Try<os::Memory> mem_ = os::memory(); if (mem_.isError()) { LOG(WARNING) << "Failed to auto-detect the size of main memory: '" << mem_.error() << "' ; defaulting to DEFAULT_MEM"; mem = DEFAULT_MEM; } else { Bytes total = mem_.get().total; if (total >= Gigabytes(2)) { mem = total - Gigabytes(1); // Leave 1GB free. } else { mem = Bytes(total.bytes() / 2); // Use 50% of the memory. } } On Thu, May 21, 2015 at 7:35 AM, Alexander Gallego <[email protected]<mailto:[email protected]>> wrote: Basically all the info you need is in os.hpp in the stout lib of mesos. Effectively, the cpus are just a syscall: sysconf(_SC_NPROCESSORS_ONLN); The memory on the other hand is calculated: # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 3, 23) memory.total = Bytes(info.totalram * info.mem_unit); memory.free = Bytes(info.freeram * info.mem_unit); # else memory.total = Bytes(info.totalram); memory.free = Bytes(info.freeram); # endif On Thu, May 21, 2015 at 6:51 AM, Aaron Carey <[email protected]<mailto:[email protected]>> wrote: I've managed to increase the disksize by playing with some docker options, Anyone have any idea about the memory? Thanks, Aaron ________________________________ From: Aaron Carey [[email protected]<mailto:[email protected]>] Sent: 21 May 2015 11:19 To: [email protected]<mailto:[email protected]> Subject: How slaves calculate resources Hi, I was just trying to figure out how Mesos slaves report the amount of resources available to them on the host? We have some slaves running on AWS t2.medium machines (2cpu, 4Gb RAM) with 32GB disks. The slaves are running inside docker containers. They report 2 cpus (correct), 2.5GB RAM and 4.9GB disk. Any ideas why this is different from what I can see on the machine? (both on the host and within the slave docker container)? Thanks, Aaron -- Sincerely, Alexander Gallego Co Founder & CTO

