Reading the Redis documentation on Virtual Memory at:
http://redis.io/topics/virtual-memory
With regards to “vm-max-threads” they say “This is the maximum number of threads used in order to perform I/O from/to the swap file. A good value is just to match the number of cores in your system.”
I dont understand why this should match the number of cores, as from my understanding once a lookup is made for something in the redis swap then this is delegated to one of these threads, however they will presumably immediately enter some suspended IO waiting stage after issuing the read file call allowing the CPU to do other work?
Redis VM was already deprecated in Redis 2.4, and has been removed in Redis 2.6. It is a dead end: don’t use it.
Using the number of cores for the vm-max-threads was only a rule of thumb. As you pointed out, these threads will be either waiting for some job to do, either waiting for the completion of synchronous I/Os. Furthermore these threads are dynamically spawned.
The correct value actually depends on how the I/Os can be parallelized, rather than the pure CPU consumption of these threads. If the swap file is striped on an array of SSD disks, then using more threads make sense (possibly more than the number of CPU cores). If your swap file is on a single rotational disk, then it does not. But because of the filesystem cache, some I/Os will be kept logical (and therefore will not generate physical wait states), so putting at least the number of cores is a good general purpose choice.