Docker Community Forums

Share and learn in the Docker community.

Docker fusion memory page how it's work?


(Bomongo) #1

Hello i’m on manjaro linux last version and i have question, how can fusion memory page in docker for reduce memory usage.

for example i have in my machine 10 docker with run same program, for example i create this c program (400mb of memory usage)

#include <stdio.h>
#include <stdlib.h>
int main(void) {
	int i;
	int size = 100000000;
	int *pointer;
	pointer = malloc(size * sizeof(int));

	for (i = 0; i < size; i++) {
		*(pointer+i) = i;
	}

	while (1) {
		sleep(1);
	}
}

in docker i enable overlayfs2

when i run docker info i have activate overlayfs2
but i use brtfs backing filesystems not ext4 or xfs (may be this is problem)

when i run 4 docker with my c code i have 3 docker with use 400mb memory usage (1.2gb)

i want to fusion memory page for have only 400mb memory usage not 1.2gb.

i run my docker like this :
sudo docker run --ipc=host mydocker

Overlayfs2 can fusion same memory ?

if no, in my research i found some topic that explain that i must use ksm (kernel same page) for this, but must use ksm for fusion same memory ? if yes how use ksm on docker ?

thanks for advance for your help.