I'm using t1.micro
EC2 instance with Amazon Linux. Since the micro instance has limited RAM (589MB RAM in total), it is insufficient for many operations such as installing & compiling Python packages. Some tutorials suggest me to make use of a Swap file to increase performance, as follow:
sudo fallocate -l 1G /tmp/swapfile
sudo chmod 600 /tmp/swapfile
sudo mkswap /tmp/swapfile
sudo swapon /tmp/swapfile
and remove it by:
sudo swapoff /tmp/swapfile
sudo rm /tmp/swapfile
I think this will increase Disk I/O, but it will benefit the overall performance. Should I enable a large swap file when the OS is booted up & leave it always active? If yes, how to achieve this?
FYI: the output of the free -m
command is as follow:
[ec2-user@myhostname ~]$ free -m
total used free shared buffers cached
Mem: 589 340 249 0 13 97
-/+ buffers/cache: 229 360
Swap: 0 0 0