First, when the system requires more memory than is physically available it starts to swap, see and understand: All about Linux swap space - Linux.com
So what u are trying to achieve is that your physically memory is used as best, therefor search for How to adjust and optimize server...