Move compiled directories to their own path for better caching - #707
Open
janhenckens wants to merge 3 commits into
Open
janhenckens wants to merge 3 commits into
janhenckens wants to merge 3 commits into
Conversation
|
janhenckens
marked this pull request as ready for review
September 15, 2026 18:25
Member
|
@janhenckens Is there an option to clear that cache via a command? Backend setting? |
Member
Author
@kristofser Craft has a command and a UI to clear those caches and that all works as it would without this change and with or without the RAM disc. Clearing it from the Combell side or the filesystem itself is not possible |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



On each request, both frontend and control panel, Craft reads the
compiled_classedandcompiled_templatesdirectories. If we can make reading these directories faster, we should be able to improve performance.Combell packages with 50GB and higher have a "RAM Disc" feature, a way to speed up reading & writing files. If we can move these folder to such a RAM disc, that should speed things up. However, this virtual disc is not unlimited in size (default is 256MB max) and it acts like a real disc, meaning that if it's full it will throw an error.
In a default Craft install, these folders are located in
storage/runtime, along sidetemp,assets,debug,mutex, ... and to enable this feature for a hosting package we need to set a path at which the server should "place" the virtual disc.If we were to put the entire
storage/runtimedir in the RAM disc, we run the risk ofstorage/runtime/tempfilling up (depending on the project of course, with temp uploads, generated exports, etc) and cause an a breaking error.This PR tries to solve that by moving the 2
compileddirectories out ofstorage/runtimeand into their own (custom)storage/appcachefolder, allowing us to configure that path as the virtual drive.We also keep the appcache dir in the folder shared across deploys so we do with the regular
storage/runtimedirectory.The service only moves the directories when the related environment variable
CRAFT_COMPILED_PATH=""is set and this runs without error and across environments regardless of the variable being set and the RAM disc being enabled.@Numkil @HannahDeWachter @SarahOorts @kristofser Could you have look to see if this makes sense?