If your deployments are taking a long time, you should check that your server is not running low on memory.
How do I check the Free Memory on my Server
Run the command:
$ free -m
You should see something like this:
This means that the server is running almost fully in swap space and it will have serious implications on performance.
Any server operations (or application operations) will be extremely slow as it is using disk instead of memory.
If your application needs more memory, the operating system may kill processes at random - see: OOM killer
What often happens is asset compilation starts taking longer and longer to run eventually timing out, giving the appearance that the deployment has hung.
Alternatively, the OS is killing the process (hence we don’t get any notification when it is complete)
But nothing changed?
Underlying package version changes can sometimes affect memory usage drastically ie. adding a new webpacker package (which itself brings in a large complex package as a dependency that needs a lot more memory to compile)
Normal application changes can also incur memory changes (ie. an innocent storage mechanism could leak)
Sometimes events can occur on the cloud provider that result in less memory being available at a specific time.
Issue with the underlying hardware or another instance on the same physical bursting memory at the point you needed it
What action should I take to fix the problem?
There are two things you can try in this situation.
Restart the Server — This will free currently used swap. Note that this helps in the case that the swap usage was not due to normal usage but rather some event that spiked memory usage in the past (and will not happen again)
Resize the Server — If you continue to experience issues you should Increase the memory size on the server. The best way to do this is to scale up to a larger server, and then remove the old one. Alternatively you can resize the server via your Cloud control panel.