How to achieve memory deduplication?

Since containers consist of layers, multiple containers based on the same image will share the same layer.

I see that /disk (at least with ROSE installed) supports the btrfs format which, under the hood, supports copy-on-write making deduplication possible on the file system level. Thus the kernel can minimize RAM allocation by reading blocks shared among multiple containers just once.

But that’s theory, have anyone tried / benchmarked that in practice?

I see that there is an undocumented parameter in /container/config: layer-dir.

I wonder whether it’s for the container extraction algorithm used by RouterOS to share common layers and works even on ext4. Has anyone tried it?