State of Sector Infos #795
Replies: 4 comments 17 replies
-
One last idea: we could potentially reduce precision of pledge and termination fee fields by a lot and lose almost nothing. There's not much value in the long list of digits near the attofil range. |
Beta Was this translation helpful? Give feedback.
-
Other ideas that have been floating around that I forgot to write down:
|
Beta Was this translation helpful? Give feedback.
-
Termination fee is 20% of state?! OMG so keen to simplify it. |
Beta Was this translation helpful? Give feedback.
-
Thanks for writing this up! The large number of dead sector infos has been motivating some discussion in the Lotus team about simply cleaning them all up in a one-time migration that runs in a network upgrade. I prototyped this over the weekend in order to see the impact it would have, and the results are encouraging. Running the compact partitions logic on every single mutable deadline[1], of every single miner, results in the size of a single state tree decreasing from ~65 GiB to ~42 GiB, a saving of 35%! In addition to reduced disk usage, this saving would also be felt in the time to download & import a snapshot, as well as the monthly $$ of infrastructure that hosts snapshots. Further, this operation is fast enough to run in a migration, taking only on the order of a few minutes without any cached premigrations. It may of course be contentious to "operate" on every miner actor in a network upgrade, though I believe this effect should have no impact on miner operations. If we wanted to consider a more conservative approach, we can only apply this compaction to "inactive" miners, which I define as those miners whose [1] One important caveat here is that the results are based on skipping "immutable" deadlines (which, IIUC, at any given time are 2/48 deadlines), but NOT skipping disputable deadlines (which at any given time are 30/48 deadlines). If we do this, we may not be able to correctly dispute proofs for a 15 hour window after the migration (specifically invalid proofs that were submitted, but not yet disputed, before the migration). I would like to argue that this is fine, but we may need to resolve this. [2] If we were to adopt this approach, to be completely safe, we will probably want to only compact those miners whose |
Beta Was this translation helpful? Give feedback.
-
Sector infos by far dominate the size of the filecoin state: https://ipfs.io/ipfs/QmdymZ81atAuvZShbpbmGC1dTiWBBw1W2t4PDkPhw3Ev6r 58G of ~75G of state.
I recently did a quick analysis of what is taking up all the space and have some numbers that will be generally useful for anyone planning to modify sector info fields or looking for opportunities to reduce filecoin state.
Data storage by sector info field
This is the result of adding up the serialized bytes of every field of sector info (live and dead) and summing together:
About half of sector info storage is used for CommR
InitialPledge and the two termination fee calculation fees each contribute ~10% for a total of 30%
SectorNumber, Activation and Expiration are each about 5% for a total of 15%
The remaining fields share the last 10%
SectorInfo categorizations
Almost half of sector infos are dead and could be cleaned up with compaction
Reducing state size
Some ideas
Do better at removing dead sectors
It is probably scalable to remove expired and terminated sector infos during cron. We should investigate whether there is some correctness reason not to do this, address any correctness issues, double check that it is not too much cron gas and then implement this.
Simplify termination fee
The termination fee calculation is taking 20% or 12GiB of state. We can likely reduce this by sacrificing some precision in the termination fee calculation.
Move sector info off chain
This one is not easy or concrete. It is a design direction not a concrete proposal.
We could make the whole sector info private as explored in the Private Sector Info section here: #530
Beta Was this translation helpful? Give feedback.
All reactions