1

We use the Craft CMS headlessly. We have a deployment with 5 sites and an entry type with a very complicated Matrix field. We are using a Digital Ocean Volume (like AWS EBS) for the Craft storage directory.

Saving entries can sometimes take many minutes. I've looked at Digital Ocean performance charts (Insights) and we're not hitting the ceiling on the app nor database servers.

enter image description here enter image description here

Is the Volume a likely suspect for investigating save performance. Is there are a lot of disk usage as part of an entry Save? I would have thought this would only be an expensive task for the database.

1 Answer 1

3

Even if a request (or specifically an Element save operation) doesn't make much use of a file-based cache, it will likely compile and read templates from the storage directory. Logs will also be written here, which depending on the level set in app.php could be a major contributing factor.

This location should almost always be a local filesystem (and considered disposable or at least node-agnostic), as it's intended to be available for instant access. Putting it on the other end of a network roundtrip could make an operation that is expected to take a few microseconds (i.e. “random read” disk speed—or even nanoseconds when using modern Unix’s ramfs optimizations) to multiple milliseconds. That compounds really quickly, if you have a few thousand reads.

I'm not sure why the load here would spike, though, unless this long-lasting save request is tying up threads in your web process and queueing incoming connections? My hunch would be that load would stay low, as most of the time it's just hanging around waiting for the volume to respond…

2
  • I've moved the storage directory to the same droplet (app server) that Craft is running on but I'm still experiencing slow saves on some entries. So the issue isn't entirely related to using a Volume for storage. Possibly it's just an inefficiency in Craft when dealing with complex entry types...
    – weotch
    Commented Oct 8, 2021 at 15:25
  • If it's still taking multiple minutes (really, more than a few seconds) to save anything in the control panel, it's definitely worth enabling the Yii Debug toolbar in your User's settings/preferences pane. This will contain loads of information for you to hone in on what tasks are eating up the most time, as part of each request. Once it's enabled, try saving the Entry again and navigate to the request (should be labeled actions/entries/save-entry, or something similar). Commented Oct 8, 2021 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.