I have a small photography portfolio website running on Ubuntu. It's a Digital Ocean droplet with the following parameters:
- 512RAM memory
- 1 vCPU
- 20GB SSD disk
- 1TB transfer
This setup is sufficient for my needs when it comes to handling user traffic, which is very low. However, as the website features photos, I have an Admin Panel logic for creating new galleries - and the uploading part goes heavy on the server.
The files I upload are weight approx. 8MB; the photos are scaled down and saved locally in multiple (5) sizes. At times, there are 20 photos chosen for a gallery, uploaded asynchronously 3 at a time.
I noticed that when the upload is running, the CPU usage on the host jumps from 20 to 100%, while the memory usage stays at around 50-60%. Disk I/O also peaks. The upload process always succeeds but it's very slow and I have no clue what to enhance to speed it up.
I'm not good at this, so I'm looking for any insights on why would the upload process put so much load on the CPU and what should I scale up to increase the performance of the server and decrease the photos upload time.
Any ideas?