Skip to content

Conversation

hebasto
Copy link
Member

@hebasto hebasto commented Feb 11, 2023

Combined #27077 and #27083 for the sake of more representative testing.

The second run looks promising:

Although, the "previous releases" task has a 66.10 % cache hit rate. It needs more investigation (not in this PR).

@DrahtBot
Copy link
Contributor

DrahtBot commented Feb 11, 2023

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.
A summary of reviews will appear here.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #27360 (ci: use LLVM/clang-16 in native_asan job by fanquake)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@DrahtBot DrahtBot added the Tests label Feb 11, 2023
.cirrus.yml Outdated
@@ -5,8 +5,9 @@ env: # Global defaults
TEST_RUNNER_PORT_MIN: "14000" # Must be larger than 12321, which is used for the http cache. See https://cirrus-ci.org/guide/writing-tasks/#http-cache
CI_FAILFAST_TEST_LEAVE_DANGLING: "1" # Cirrus CI does not care about dangling process and setting this variable avoids killing the CI script itself on error
CCACHE_SIZE: "200M"
CCACHE_DIR: "/tmp/ccache_dir"
CCACHE_DIR: '${CIRRUS_WORKING_DIR}/ccache_dir'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will still be in the same volume (tmp), so why is this changed?

Copy link
Member Author

@hebasto hebasto Feb 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the difference for Cirrus CI is not using absolute path /tmp/....

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still not sure what this means and which paths are preferred or discouraged

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hebasto hebasto marked this pull request as ready for review February 11, 2023 15:20
@hebasto
Copy link
Member Author

hebasto commented Feb 11, 2023

The PR description has been updated with some statistics.

@fanquake
Copy link
Member

Most of the changes here look straight forward enough, and clearly improve ccache usage, but this is blocked on at least an answer to this question: #27084 (comment).

@hebasto
Copy link
Member Author

hebasto commented Feb 21, 2023

@fanquake @MarcoFalke

... but this is blocked on at least an answer to this question: #27084 (comment).

I've dropped the first commit and faced some weird issues which I saw in #27083 before. Going to provide steps to reproduce that unwanted behavior.

Making this PR a draft for now.

@hebasto hebasto marked this pull request as draft February 21, 2023 08:31
This change avoids any possible cache binary incompatibility.
By default, `ccache` includes the modification time (`mtime`) and size
of the compiler in the hash to ensure that results retrieved from the
cache are accurate. But in CI environment compiler's `mtime` can be
unique each run.
This change improves cache hit rates for the touched CI tasks.
@hebasto hebasto marked this pull request as ready for review February 21, 2023 12:58
@hebasto
Copy link
Member Author

hebasto commented Feb 21, 2023

The questionable commit has been dropped.

Ready to re-review.

Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@@ -36,6 +36,8 @@ main_template: &MAIN_TEMPLATE
timeout_in: 120m # https://cirrus-ci.org/faq/#instance-timed-out
ccache_cache:
folder: "/tmp/ccache_dir"
fingerprint_script: echo ${CIRRUS_TASK_NAME}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this already the default?

By default the task name is used as a fingerprint value.

https://cirrus-ci.org/guide/writing-tasks/#cache-instruction

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this already the default?

Yep looks like it.

@@ -36,6 +36,8 @@ main_template: &MAIN_TEMPLATE
timeout_in: 120m # https://cirrus-ci.org/faq/#instance-timed-out
ccache_cache:
folder: "/tmp/ccache_dir"
fingerprint_script: echo ${CIRRUS_TASK_NAME}
reupload_on_changes: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this already the default?

true otherwise

https://cirrus-ci.org/guide/writing-tasks/#cache-instruction

@hebasto hebasto marked this pull request as draft February 27, 2023 14:53
@hebasto
Copy link
Member Author

hebasto commented Mar 1, 2023

Well, speaking of the removed questionable commit, I've finally managed to provide steps to reproduce unexpected behavior without that commit:

  1. Complete all tasks.
  2. Re-run, for example, the "32-bit + dash [gui] [CentOS 8]" task. As expected, ccache achieves 100% hit.
  3. Add a commit which does not change any code and run CI job. It is natural to expect that ccache in the "32-bit + dash [gui] [CentOS 8]" task will 100% hit again. But that is not the case. Somehow, ccache's cache is "contaminated", which, in turn, causes some misses.

Besides the description above, I have no decent explanation of what is really happening. But s/tmp/ccache_dir/${CIRRUS_WORKING_DIR}/ccache_dir/ solves this issue.

@maflcko
Copy link
Member

maflcko commented Mar 1, 2023

It would be good to double check if this is recommended "officially" by Cirrus CI. In any case CIRRUS_WORKING_DIR isn't under /tmp/ on macos, so maybe it makes sense for that reason already?

@maflcko
Copy link
Member

maflcko commented Mar 1, 2023

I guess instead of ${CIRRUS_WORKING_DIR}/ccache_dir you can also just write ccache_dir, as CIRRUS_WORKING_DIR is implicit?

@hebasto
Copy link
Member Author

hebasto commented Mar 1, 2023

I guess instead of ${CIRRUS_WORKING_DIR}/ccache_dir you can also just write ccache_dir, as CIRRUS_WORKING_DIR is implicit?

While it works for the folder property of the ccache_cache, it seems the CCACHE_DIR variable is supposed to contain an absolute path.

@maflcko
Copy link
Member

maflcko commented Mar 13, 2023

lgtm. While it would be good to be able to point to docs, I don't think this is required. Happy to review if you move this out of draft.

@DrahtBot
Copy link
Contributor

DrahtBot commented May 2, 2023

🐙 This pull request conflicts with the target branch and needs rebase.

@fanquake
Copy link
Member

What is the status of this

@hebasto
Copy link
Member Author

hebasto commented May 17, 2023

What is the status of this

I've analyzed the recent ccache summaries at a75c77e.

I don't think this PR can improve them.

@hebasto hebasto closed this May 17, 2023
@bitcoin bitcoin locked and limited conversation to collaborators May 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants