How to force processes to be reloaded back into memory from swap?

3

1

I have a nightly cron job that does a lot of data import and database inserts on my personal laptop. It runs for a couple hours, but it uses enough memory that come morning, my Gnome desktop is frozen for several minutes as everything seems to have been pushed out of memory onto swap, even though the process finished hours ago.

Is there any way for me to configure Gnome to reload running components and applications (lightdm, gnome-shell, firefox, etc) back into memory when memory becomes available again?

Cerin

Posted 2017-05-19T13:30:18.070

Reputation: 6 081

So by morning, the database job has finished and freed up the memory again right? – djsmiley2k TMW – 2017-05-19T13:33:44.150

2Cerin, what about combining drop_caches ("echo 3 > /proc/sys/vm/drop_caches" as root, or 1 or 2) to clean page cache (both db and gnome files will be dropped from memory), and rerunning some kind of readahead service (if there is such and it was configured to read gnome data)? Or you may try to do "swapoff -a; swapon -a" to move all data from swap (also do reconfigure vm.swappiness sysctl to low value). What is your morning output of free command? Using SSD may help to make your swap faster too... – osgx – 2017-05-20T05:53:44.220

1Within the possibility of stupid simple, what would happen if you schedule a job to run "early" in the morning which opens a GUI. Would that have the same effect as when you actually start typing? With things like xdotool, you could even automate keyboard/mouse input. This wouldn't "solve" anything, but it might get rid of the symptoms. – Joe – 2017-05-23T09:40:37.187

No answers