balena-io-experimental / balena-virt

Easy virtualization of balenaOS
MIT License
46 stars 7 forks source link

Starting multiple devices simultaneously results in memory peak #8

Open maggie44 opened 2 years ago

maggie44 commented 2 years ago

When launching many devices at once, the simultaneous launch creates a memory peak.

'BV maintains two trees of pages, one stable, one unstable. Volatile pages aren't scanned for merging, so during bootup, all of these machines consume approximately N times the allocated memory space. After things cool down, KSM starts working. We could vastly increase the number of machines that can run on a single host by delaying each launch by a reasonable amount of time to allow KSM to merge pages for each new host without becoming overloaded. Maybe a minute or so, depending on boot speed and whatnot'.