It might be worth adding some swap to the server if there's none already. Although frequently swapping can be really really bad for performance, it can help when you want to run memory intensive stuff like composer by allowing the server to move less frequently used memory pages out of main memory and on to the disk.
First, check if you have swap already - run
free -m and look at the fourth line, it may show 0 in the "total Swap:" line. If it shows more, you may already have swap, but I believe the default is zero.
To add 1GB of swap, I'd suggest running these as root:
dd if=/dev/zero of=/swap.file bs=1M count=1024
echo "/swap.file none swap sw" >> /etc/fstab
This will add 1GB of swap to the server in a file on the root disk, and configure it to come back at bootup. If you run
free -m it should show 1GB of swap in the bottom line.
If performance suffers, you can remove it:
swapoff /swap.file # this might take a short while if swap has been enabled for a long time
vi /etc/fstab # this will open your fstab in $EDITOR, find the line that references swap.file and delete it.