Bug 14819 - ccache needs CCACHE_MAXSIZE set to be useful
Summary: ccache needs CCACHE_MAXSIZE set to be useful
Status: RESOLVED INVALID
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: devtools / tool chain (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Undecided enhancement
Target Milestone: ---
Assignee: Unassigned
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2022-05-26 23:19 UTC by Zach Welch
Modified: 2022-05-27 03:51 UTC (History)
2 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.