I was sorting a large file (101MB
- about 700MB
after unzipping) using sort command on server that has 48GB of memory. It was the only heavy job it was doing at that time. However I noticed that sort created lots of temporary files. Does it mean it was lacking RAM memory?
Or is it so that sort always creates files? Can I speed up sorting process by passing a folder filesystem mounted in RAM with -T
command? I tried it, but I haven't noticed significant speed up and I'm wondering whether I constructed the test wrong or I'm just not understanding what's going on correctly.
This is a command I issued:
zcat file0.nq.gz | sort
In about 20 seconds I have the following files in /tmp
nuoritoveri@nubis:/tmp[127]$ ls
sortecuGwN sorteKeowj sortGn7dCr sortkdk5Ws sortNb9Khh sortPGTQ6b sortQearCg sortvBB5eS sortZW2mWj
sort1UsQla sortEGauDb sortFMn7bW sortiUDJYd sortlaGUgo sortpEmGb5 sortPQUNQx sortqlb7jh sortxcjjuM
sortaVKeEN sortejgptJ sortgAJJ9l sortJRq2GB sortmQf888 sortpFfWdy sortpv9kO8 sortT52TVQ sortxq8r80
The files disappear when commands finishes. I also checked what happens when I don't pipe, but just sort unzipped file:
sort file0.nq
The files in /tmp
appear also, but not such a fast rate (maybe because it has to read the file by itself).
sort
creating files. Could you give an example of the file (path) that was created?/tmp
is not swap. If the computer uses swap, it wouldn't create files in/tmp
, it would just use the swap partition - assuming there's a swap partition.