GATK without swap usage
I asked a recent question about using picardtools on a cluster with strict swap limits, now I've moved onto using the indelrealigner tool in GATK. My issue is that if GATK starts using the swap, it is killed. I can get more ram by requesting more cores, but I want to minimize the number of cores I'm using.
I've been changing my total ram, and also the amount of ram I give java using the -Xmx option. After some experimentation, it seems like giving java more ram actually makes it worse. For example if I run it with 60G of ram total for the job, and give java 50G, it will almost immediately go into the swap, even though my BAM file is only 5G. On the other hand, if I only have 8G of ram for the job and give java 1G, it runs for much longer, although I'm unsure if this fixes the issue for all files.
My main question is if there is a general rule of thumb for using GATK without using the swap. Is it to minimize the amount of ram given to java? Does this even make sense based on how the program works?