I’ve had a server that’s been running Tumbleweed for a year or two now. I update it every now to the latest tumbleweed. I’ve just recently put Apache, mod_perl, and MySQL on the server to run a particular web application. Ever since then the memory on this server (which I’ve increased from 4 GB to 8 GB) continues to grow until the whole box craps itself due to running our of memory. It normally only takes a week. The uncontrolled growth happens within slab memory.
The btrfs caches grow significantly, and running
sync; echo 3 > /proc/sys/vm/drop_caches
doesn’t do anything at all. kmalloc-4k is also continually growing. See below:
Btrfs is not always the best for everybody and not for every application.
Are your MySQL database files stored in btrfs subvolumes? According to https://en.opensuse.org/SDB:BTRFS locations like /var/lib/mariadb or /var/lib/mysql should be exempt from snapshots because it could cause frequent filesystem writes, excessive wear on SSD storage, and prossibly the high btrfs-related counts you pasted and the effects on memory you observe.
If you happen to have a partition large enough for your database, try formatting it with ext4 and running your active database from there.
You’ll find that these two types of memory management can be an indication of your system’s activity, but unless their values approach the limits of your physical memory, you shouldn’t be concerned with their growing sizes…
Summarizing,
You can think of both as virtual “containers” of physical memory blocks of various sizes, the slabs are larger block sequences and the kmallocs are smaller. Today’s modern systems recognize that it’s more costly to allocate/write/erase/delete data than to simply leave the data in memory, and a significant cost to writing is allocating properly sized contiguous memory blocks. Slab and kmalloc “containers” are pre-allocated mappings of various sized contiguous blocks to minimize that cost, when a system wants to write something to memory, it will first look for and try to re-use a properly sized mapping to write to, or erase/delete and write.
Bottom line,
You should look in other directions to improve performance, IMO website code is often abominable, and in particular it’s useful to understand how a website performs on a LAMP setup which will require and set up sufficient and persistent database connections compared to… for example nginx which is of a type that minimizes both database and server/client connection persistence with the idea it can be more efficient to create and destroy connections as quickly as possible instead of devoting resources to connections which may not be full.
In other words, it can be extremely important to do a website performance analysis, and this can require intimate knowledge not only of the code but then how best to deploy code the way it’s written.
HTH and open to any corrections if people feel I’ve described any of this incorrectly…
TSU
Just an additional thought…
A noticeable increase in 4k memory blocks (your kmalloc-4k) might indicate more webpages and/or components being created instead of being re-used.
Getting back to whatever your website is serving,
Try to understand which page objects are brand new with every webpage view, if pages stay relatively the same and can be served from cache or if objects are really changing, and if so how fast. 4k objects are pretty small which would be a bit unusual. If for instance you’re serving similar pages but with updated data, is that data only a line or two and not arrays of data?