hostd icon indicating copy to clipboard operation
hostd copied to clipboard

Improve renewal RPC performance

Open n8mgr opened this issue 7 months ago • 0 comments

Adds an additional table to map sector roots to a contract. This helps improve the performance of contract renewals. Previously when renewing, every sector root record had to be updated with the new foreign key. This caused the renew RPC to take up to 30s for contracts over 5TiB. With this change only a single record needs to be updated when renewing.

BenchmarkRenewContract/1000_sectors-16              2830            466750 ns/op       1000 sectors         32214 B/op        411 allocs/op
BenchmarkRenewContract/10000_sectors-16             2902            475401 ns/op      10000 sectors         32181 B/op        411 allocs/op
BenchmarkRenewContract/100000_sectors-16            3141            478208 ns/op     100000 sectors         32149 B/op        411 allocs/op
BenchmarkRenewContract/1000000_sectors-16           2794            493699 ns/op         1000000 sectors          32187 B/op        411 allocs/op

This is a significant change to sector management and should be thoroughly tested before release.

n8mgr avatar Apr 19 '25 22:04 n8mgr