This question already has an answer here:
I've got a VM with 16gb of memory and recently it's been using some of the swap space. At first I thought this was because it was using all the memory but then I read some articles about the Cached Memory and how the Linux Kernel uses extra memory for caching. Checked that and saw that I've got about 13gb being allocated to caching. I haven't been able to find any answers though as to why swap is being used. Shouldn't the kernel use memory that is being used as Memory Cache space before it starts using swap space?
Thanks for linking me to that other question, didn't find that for some reason before.