Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(bin): show snapshots in db stats #6285

Merged
merged 6 commits into from
Feb 2, 2024

Conversation

shekhirin
Copy link
Collaborator

@shekhirin shekhirin commented Jan 30, 2024

Snapshot stats per segment, similar to database stats per table:

reth (alexey/db-stats-snapshots) cargo run --bin reth -- db stats --chain holesky                                                                                                                                                                                                                                          ✭
    Finished dev [unoptimized + debuginfo] target(s) in 0.40s
     Running `target/debug/reth db stats --chain holesky`
| Segment      | Block Range     | Transaction Range  | Shape        | Data Size | Index Size | Offsets Size | Config Size | Total Size |
|--------------|-----------------|--------------------|--------------|-----------|------------|--------------|-------------|------------|
| Headers      | 0..=499999      | N/A                | 3 x 500000   | 270.1 MiB | 0 B        | 11.4 MiB     | 54 B        | 281.5 MiB  |
| Headers      | 500000..=834214 | N/A                | 3 x 334215   | 181.9 MiB | 0 B        | 7.6 MiB      | 54 B        | 189.5 MiB  |
| Transactions | 0..=499999      | 0..=1903501        | 1 x 1903502  | 664.1 MiB | 0 B        | 14.5 MiB     | 70 B        | 678.7 MiB  |
| Transactions | 500000..=850110 | 1903502..=26189416 | 1 x 24285915 | 5.4 GiB   | 0 B        | 185.3 MiB    | 70 B        | 5.6 GiB    |
| Receipts     | 0..=499999      | 0..=1903501        | 1 x 1903502  | 89.3 MiB  | 0 B        | 14.5 MiB     | 70 B        | 103.8 MiB  |
| Receipts     | 500000..=850110 | 1903502..=26189416 | 1 x 24285915 | 824.2 MiB | 0 B        | 185.3 MiB    | 70 B        | 1009.5 MiB |
| ------------ | --------------- | ------------------ | ------------ | --------- | ---------- | ------------ | ----------- | ---------- |
| Total        |                 |                    |              | 7.4 GiB   | 0 B        | 418.7 MiB    | 388 B       | 7.8 GiB    |


| Table Name        | # Entries | Branch Pages | Leaf Pages | Overflow Pages | Total Size |
|-------------------|-----------|--------------|------------|----------------|------------|
| AccountChangeSet  | 22848833  | 30988        | 233306     | 0              | 1 GiB      |
| AccountHistory    | 15796642  | 13149        | 915204     | 2568           | 3.6 GiB    |
| AccountsTrie      | 1346150   | 415          | 89748      | 0              | 352.2 MiB  |
| BlockBodyIndices  | 850111    | 23           | 4931       | 0              | 19.4 MiB   |
| BlockOmmers       | 0         | 0            | 0          | 0              | 0 B        |
| BlockWithdrawals  | 841398    | 538          | 120150     | 0              | 471.4 MiB  |
| Bytecodes         | 10886     | 19           | 1014       | 23383          | 95.4 MiB   |
| CanonicalHeaders  | 849545    | 163          | 20024      | 0              | 78.9 MiB   |
| HashedAccount     | 15793454  | 4885         | 299445     | 0              | 1.2 GiB    |
| HashedStorage     | 10099254  | 4374         | 188538     | 0              | 753.6 MiB  |
| HeaderNumbers     | 850111    | 270          | 15299      | 0              | 60.8 MiB   |
| HeaderTD          | 849545    | 20           | 4186       | 0              | 16.4 MiB   |
| Headers           | 849545    | 1795         | 206807     | 0              | 814.9 MiB  |
| PlainAccountState | 15793454  | 2503         | 234574     | 0              | 926.1 MiB  |
| PlainStorageState | 10099254  | 4169         | 185959     | 0              | 742.7 MiB  |
| PruneCheckpoints  | 1         | 0            | 1          | 0              | 4 KiB      |
| Receipts          | 25775366  | 1144         | 255656     | 99069          | 1.4 GiB    |
| StorageChangeSet  | 13072606  | 28481        | 192555     | 0              | 863.4 MiB  |
| StorageHistory    | 10340037  | 20559        | 714852     | 736            | 2.8 GiB    |
| StoragesTrie      | 973113    | 6118         | 65747      | 0              | 280.7 MiB  |
| SyncStage         | 14        | 0            | 1          | 0              | 4 KiB      |
| SyncStageProgress | 1         | 0            | 1          | 0              | 4 KiB      |
| TransactionBlock  | 685732    | 21           | 4396       | 0              | 17.3 MiB   |
| Transactions      | 0         | 0            | 0          | 0              | 0 B        |
| TxHashNumber      | 26189417  | 8161         | 485665     | 0              | 1.9 GiB    |
| TxSenders         | 26024907  | 1088         | 243227     | 0              | 954.4 MiB  |
| ----------------- | --------- | ------------ | ---------- | -------------- | ---------- |
| Tables            |           |              |            |                | 18.1 GiB   |
| Freelist          | 1974764   |              |            |                | 7.5 GiB    |

Can also show only total size per snapshot segment with --only-total-size argument:

reth (alexey/db-stats-snapshots) cargo run --bin reth -- db stats --chain holesky --only-total-size                                                                                                                                                                                                                        ✭
    Finished dev [unoptimized + debuginfo] target(s) in 0.40s
     Running `target/debug/reth db stats --chain holesky --only-total-size`
| Segment      | Block Range     | Transaction Range  | Shape        | Size       |
|--------------|-----------------|--------------------|--------------|------------|
| Headers      | 0..=499999      | N/A                | 3 x 500000   | 281.5 MiB  |
| Headers      | 500000..=834214 | N/A                | 3 x 334215   | 189.5 MiB  |
| Transactions | 0..=499999      | 0..=1903501        | 1 x 1903502  | 678.7 MiB  |
| Transactions | 500000..=850110 | 1903502..=26189416 | 1 x 24285915 | 5.6 GiB    |
| Receipts     | 0..=499999      | 0..=1903501        | 1 x 1903502  | 103.8 MiB  |
| Receipts     | 500000..=850110 | 1903502..=26189416 | 1 x 24285915 | 1009.5 MiB |
| ------------ | --------------- | ------------------ | ------------ | ---------- |
| Total        |                 |                    |              | 7.8 GiB    |


| Table Name        | # Entries | Branch Pages | Leaf Pages | Overflow Pages | Total Size |
|-------------------|-----------|--------------|------------|----------------|------------|
| AccountChangeSet  | 22848833  | 30988        | 233306     | 0              | 1 GiB      |
| AccountHistory    | 15796642  | 13149        | 915204     | 2568           | 3.6 GiB    |
| AccountsTrie      | 1346150   | 415          | 89748      | 0              | 352.2 MiB  |
| BlockBodyIndices  | 850111    | 23           | 4931       | 0              | 19.4 MiB   |
| BlockOmmers       | 0         | 0            | 0          | 0              | 0 B        |
| BlockWithdrawals  | 841398    | 538          | 120150     | 0              | 471.4 MiB  |
| Bytecodes         | 10886     | 19           | 1014       | 23383          | 95.4 MiB   |
| CanonicalHeaders  | 849545    | 163          | 20024      | 0              | 78.9 MiB   |
| HashedAccount     | 15793454  | 4885         | 299445     | 0              | 1.2 GiB    |
| HashedStorage     | 10099254  | 4374         | 188538     | 0              | 753.6 MiB  |
| HeaderNumbers     | 850111    | 270          | 15299      | 0              | 60.8 MiB   |
| HeaderTD          | 849545    | 20           | 4186       | 0              | 16.4 MiB   |
| Headers           | 849545    | 1795         | 206807     | 0              | 814.9 MiB  |
| PlainAccountState | 15793454  | 2503         | 234574     | 0              | 926.1 MiB  |
| PlainStorageState | 10099254  | 4169         | 185959     | 0              | 742.7 MiB  |
| PruneCheckpoints  | 1         | 0            | 1          | 0              | 4 KiB      |
| Receipts          | 25775366  | 1144         | 255656     | 99069          | 1.4 GiB    |
| StorageChangeSet  | 13072606  | 28481        | 192555     | 0              | 863.4 MiB  |
| StorageHistory    | 10340037  | 20559        | 714852     | 736            | 2.8 GiB    |
| StoragesTrie      | 973113    | 6118         | 65747      | 0              | 280.7 MiB  |
| SyncStage         | 14        | 0            | 1          | 0              | 4 KiB      |
| SyncStageProgress | 1         | 0            | 1          | 0              | 4 KiB      |
| TransactionBlock  | 685732    | 21           | 4396       | 0              | 17.3 MiB   |
| Transactions      | 0         | 0            | 0          | 0              | 0 B        |
| TxHashNumber      | 26189417  | 8161         | 485665     | 0              | 1.9 GiB    |
| TxSenders         | 26024907  | 1088         | 243227     | 0              | 954.4 MiB  |
| ----------------- | --------- | ------------ | ---------- | -------------- | ---------- |
| Tables            |           |              |            |                | 18.1 GiB   |
| Freelist          | 1974764   |              |            |                | 7.5 GiB    |

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

I think more info/columns is better, though I think we should print the static files table first before the db

@rkrasiuk
Copy link
Member

agree w/ @mattsse

@rkrasiuk rkrasiuk added A-db Related to the database A-cli Related to the reth CLI labels Jan 30, 2024
@shekhirin shekhirin marked this pull request as ready for review January 31, 2024 13:06
@shekhirin shekhirin added the C-enhancement New feature or request label Jan 31, 2024
@shekhirin
Copy link
Collaborator Author

@mattsse @rkrasiuk do you think we should display a detailed breakdown of static file sizes by default?

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

do you think we should display a detailed breakdown of static file sizes by default?

I think so

@shekhirin shekhirin merged commit 333bc2c into feat/static-files Feb 2, 2024
24 checks passed
@shekhirin shekhirin deleted the alexey/db-stats-snapshots branch February 2, 2024 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cli Related to the reth CLI A-db Related to the database C-enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants