sort by host id to test iops cheese to improve icon read performance

This commit is contained in:
Joe Lothan 2026-05-26 00:43:11 -04:00
parent 03f6406e18
commit a30fe104a3
2 changed files with 17 additions and 16 deletions

View file

@ -128,7 +128,7 @@ func main() {
// Stage 1: DB fetcher — continuously fetches pages into hostCh
go func() {
defer close(hostCh)
var lastRandom float64 = -1
var lastID int64
pageSize := 50000
fetched := 0
for {
@ -143,14 +143,14 @@ func main() {
}
}
fetchStart := time.Now()
hosts, err := fetchHostsPage(ctx, pool, lastRandom, limit)
hosts, err := fetchHostsPage(ctx, pool, lastID, limit)
if err != nil {
log.Fatalf("Failed to fetch hosts: %v", err)
}
if len(hosts) == 0 {
break
}
lastRandom = hosts[len(hosts)-1].RandomOrder
lastID = hosts[len(hosts)-1].ID
fmt.Printf("[fetcher] %d hosts in %dms (hostCh: %d/%d)\n",
len(hosts), time.Since(fetchStart).Milliseconds(), len(hostCh), cap(hostCh))
for _, h := range hosts {