Skip to content

stats: Add debug mode to collect repository statistics#4361

Merged
MichaelEischer merged 2 commits intorestic:masterfrom
MichaelEischer:stats-repo-debug-info
Jul 8, 2023
Merged

stats: Add debug mode to collect repository statistics#4361
MichaelEischer merged 2 commits intorestic:masterfrom
MichaelEischer:stats-repo-debug-info

Conversation

@MichaelEischer
Copy link
Copy Markdown
Member

@MichaelEischer MichaelEischer commented Jun 7, 2023

What does this PR change? What problem does it solve?

restic stats --mode debug now prints statistics about the size of the individual blob / files types in a repository. The idea is to help with debugging issues related to unexpectedly high memory / cache usage.

So far the command is not shown in the help output of the stats command, as I'm not sure what use cases besides debugging would be.

Sample output:

Collecting size statistics

File Type: key
Count: 1
Total Size: 451 B
Size            Count
---------------------
100 - 999 Byte  1
---------------------

File Type: lock
Count: 2
Total Size: 302 B
Size            Count
---------------------
100 - 999 Byte  2
---------------------

File Type: index
Count: 106
Total Size: 230.657 MiB
Size                    Count
-----------------------------
    10000 - 99999 Byte  8
  100000 - 999999 Byte  3
1000000 - 9999999 Byte  95
-----------------------------

File Type: data
Count: 15428
Total Size: 246.514 GiB
Size                      Count
-------------------------------
      10000 - 99999 Byte  1
    100000 - 999999 Byte  16
  1000000 - 9999999 Byte  286
10000000 - 99999999 Byte  15125
-------------------------------

Blob Type: data
Count: 3753205
Total Size: 241.391 GiB
Size                    Count
-------------------------------
          10 - 99 Byte  46443
        100 - 999 Byte  1129200
      1000 - 9999 Byte  1569321
    10000 - 99999 Byte  628942
  100000 - 999999 Byte  311586
1000000 - 9999999 Byte  67713
-------------------------------


Blob Type: tree
Count: 1313735
Total Size: 1.178 GiB
Size                    Count
-------------------------------
          10 - 99 Byte  1
        100 - 999 Byte  1127061
      1000 - 9999 Byte  173620
    10000 - 99999 Byte  12481
  100000 - 999999 Byte  570
1000000 - 9999999 Byte  2
-------------------------------

Was the change previously discussed in an issue or on the forum?

Alternative to #2543
Fixes #1047

Checklist

  • I have read the contribution guidelines.
  • I have enabled maintainer edits.
  • I have added tests for all code changes.
  • I have added documentation for relevant changes (in the manual).
  • There's a new file in changelog/unreleased/ that describes the changes for our users (see template).
  • I have run gofmt on the code in all commits.
  • All commit messages are formatted in the same style as the other commits in the repo.
  • I'm done! This pull request is ready for review.

@MichaelEischer MichaelEischer force-pushed the stats-repo-debug-info branch from 9427245 to 2e80a42 Compare June 7, 2023 20:27
@MichaelEischer MichaelEischer force-pushed the stats-repo-debug-info branch from 2822474 to 480fada Compare June 17, 2023 15:47
@MichaelEischer MichaelEischer force-pushed the stats-repo-debug-info branch from 480fada to 0fcb6c7 Compare July 8, 2023 21:04
Copy link
Copy Markdown
Member Author

@MichaelEischer MichaelEischer left a comment

Choose a reason for hiding this comment

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

LGTM.

@MichaelEischer MichaelEischer merged commit 0512f29 into restic:master Jul 8, 2023
@MichaelEischer MichaelEischer deleted the stats-repo-debug-info branch July 8, 2023 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Information command

1 participant