Facebook proposed a new slab memory management mechanism for the Linux kernel

Roman Gushchin (Roman Gushchin) from Facebook announced in the mailing list for Linux kernel developers a set of patches implementing a new memory distribution controller slab (slab memory controller). The new controller is noteworthy for transferring slab accounting from the page level to the kernel object level, allowing for shared slab pages across different cgroups, instead of allocating separate slab caches for each cgroup.

The proposed approach increases slab usage efficiency, reduces the size of memory allocated for slab by 30-45%, and significantly decreases the overall memory consumption by the kernel. By reducing the number of non-movable slabs, there is also a positive effect on memory fragmentation. The new memory controller greatly simplifies the slab accounting code and does not require complex algorithms for dynamically creating and deleting slab caches for each cgroup. All memory cgroups in the new implementation use a common set of slab caches, and the lifespan of slab caches is no longer tied to the lifespan of those established through the cgroup limits on memory usage.

The more accurate resource accounting implemented in the new slab controller theoretically should increase CPU load, but in practice the differences have proven to be insignificant. Specifically, the new slab controller has been in use on Facebook's production servers for several months, handling various types of workloads, with no significant regressions detected thus far. Meanwhile, there has been a substantial reduction in memory usage — on certain hosts, savings of up to 1GB of memory have been achieved, although this figure heavily depends on the type of load, total RAM size, number of CPUs, and memory usage patterns. Previous tests have shown a reduction in memory usage of 650-700 MB (42% of slab memory) on the web frontend, 750-800 MB (35%) on the database cache server, and 700 MB (36%) on the DNS server.

Source: opennet.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster