Virtual memory always at 100%

Hello, I noticed that my virtual memory is always running at 99 -100% and the sometimes elasticsearch stops completely, I have to restart the server to turn it back on.

after changing the heap size in JVM (/etc/elasticsearch/jvm.options) to ( -Xms512m -Xmx512m) Its still runing the same.

any suggestions?

Give it more swap. You’ve got a huge process in elasticsearch, so give it room to breath. Presumably it uses a memory mapped file, which will consume a lot of swap.

elasticsearch stopping is unrelated to swap being at 99%, though, as long as you have free memory. You’ll need to check the log for why it’s exiting. I’d guess you’ve starved it to death with your jvm options. Those limits don’t change how much the service needs to do its job…they just prevent the service from stepping on others. If you consider elasticsearch important, you need to give it enough resources.

my Swappiness was set to 60, so I changed it to 10

sudo sysctl vm.swappiness=10

hopefully this will make my apps less reliant on virtual memory

I would like to know why my system is not using more “real memory” instead of virtual memory… any ideas?

When i was having problems like this with my swap file a week ago (99% full ), i changed the swappiness but i also created a new swapfile that was larger too (increased to 1gb)
In doing both, that fixed my problem. My system now has swapfile that is barely above 1%

Just give the system more swap. You don’t need to adjust swappiness.

But, also stop thinking this is a problem that desperately needs solved. Swap is just swap. It doesn’t matter if it’s full. As long as you real memory has plenty of free to do everything you need, you don’t need to care about swap.

Having enough swap is good, but it’s only there to allow the system to weather big spikes in real memory usage. If you have enough real memory, swap isn’t important.

Edit: I’m calling this one the solution, even though “give it more swap” is the solution to the question as posed, because the question is premised on full swap being a problem, when it generally isn’t.

This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.