Linux – How to prevent going to SWAP

linuxmemoryswap

We have a critical application which uses pretty much of our RAM memory. At most time the application stays in RAM, however there are some situation (e.g. when some other applications and deamons start using more RAM) which make it going to SWAP meaning that our application starts to respond very slowly.

Are there any ways we could prevent our application from going to SWAP?

Thanks guys!

Best Answer

Turn off swap, or use mlockall() to prevent process memory from being swapped out. There are process and system limits though of how many pages can be locked, which may need to be adjusted for your purposes.

Related Topic