Bug 14819

Summary: ccache needs CCACHE_MAXSIZE set to be useful
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Zach Welch <zach>
Component: devtools / tool chainAssignee: Unassigned <unassigned>
Status: RESOLVED INVALID QA Contact:
Severity: enhancement    
Priority: Undecided CC: meta.mr.watcher, meta.watcher
Version: unspecified   
Target Milestone: ---   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Zach Welch 2022-05-26 23:19:28 UTC
To make OE's support for ccache useful when doing full clean image builds, the CCACHE_MAXSIZE setting must be changed from its default to something much larger; otherwise, the number and size of cached objects will quickly exceed the default limit, causing some objects to be evicted before they can be reused.  The net result is a loss in performance, rather than the intended gain.

At the very least, the documentation at the top of the ccache.bbclass should cover this variable, as that offers one immediate opportunity to help users avoid this situation.  I have sent along a patch to oe-devel to cover that portion of this issue, but that does not help users of this bbclass who do not have it set.

As an extra layer of caution, it would be nice if the build system would give a warning when using a limit that will be too small.  This implies something in ccache.bbclass would run `ccache -p` and verify that the max_size setting exceeds a predefined limit.  That default min-max limit probably deserves to be set in the bbclass as well, so users can override it in the event they want to ignore this advice and use a smaller setting.
Comment 1 Zach Welch 2022-05-27 03:51:46 UTC
Per discussion on the list, the standard limit should be fine for most cases, as the CCACHE_MAXSIZE limit applies per-arch/per-recipe.  I got it into my head that it was be applied to the CCACHE_TOP_DIR, so marking this bug as RESOLVED:INVALID.