100% CPU usage until VPS shutsdown (DigitalOcean)

Hello!

I know there have been some topics created about this, but they all seems very old.

We have a small blog (the traffic can be considered negligible) on Ghost 6-alpine, using the docker compose preview.

I think our blog is sufficiently small to run on a 1CPU/1GB VPS, since all the heavy stuff (sending emails) is done by Mailgun. The problem is, the VPS keeps spiking to 100% CPU usage, stays there for about 5 minutes and then shuts down.

The Ghost logs show

ghost-1  | [2025-10-31 15:13:56] INFO "POST /ghost/api/admin/images/upload/" 200 782503ms
ghost-1  | [2025-10-31 15:14:57] WARN Ghost is shutting down
ghost-1  | [2025-10-31 15:14:58] WARN Ghost has shut down
ghost-1  | [2025-10-31 15:14:58] WARN Your site is now offline
ghost-1  | [2025-10-31 15:14:58] WARN Ghost was running for a day

(Notice how the last log was of an upload, that might be relevant?)

Caddy also shuts down, so I think DigitalOcean is actually resetting the machine somehow. Or maybe docker is restarting the compose somehow?

The more interesting part is the usage graphs on DigitalOcean:

The above image shows, in order from top to bottom, bandwidth usage, CPU% usage and disk I/O. You can see, therefore, that a CPU spike to 100% (and eventual VPS restart) is caused by a simple request that “spins out of control” and makes the disk I/O also go to crazy values (I think).

I can show more detailed logs if anyone thinks it’s necessary/helpful. But above all, there seems to be something about image upload/post editing that enter an infinite loop or something.

Thanks in advance!

EDIT: look at the time it took Ghost to process this request:

caddy-1  | 2025/10/31 13:06:29.067      INFO    http.log.access.log0    handled request {... "duration": 752.821992189 ...}

Over more than 10 minutes. Is this just because of the small size of the VPS? It seems hard to believe that it would take 1CPU core 10 minute to upload an image.

Seems like related with image optimization feature. If your theme uses img_url helper with many variations, and if you upload one or multiple high resolution images, with the first requests, Ghost tries to resize and optimize all of them. This is a resource-intensive process and with limited CPU and RAM, can cause crashing running services.

You may consider a few things:

  • Increase your VPS resources.
  • Resize your images to smaller sizes before uploading to Ghost.
  • Disable image optimization on Ghost.

All options have their own trade-offs. You need to decide best option for you.

1 Like

That is an incredibly helpful answer. Thank you so, so much!

I will discuss and implement accordingly :)