(b *testing.B)
| 1092 | } |
| 1093 | |
| 1094 | func BenchmarkPoller10k(b *testing.B) { |
| 1095 | tests := []struct { |
| 1096 | tenantCount int |
| 1097 | blocksPerTenant int |
| 1098 | }{ |
| 1099 | { |
| 1100 | tenantCount: 1, |
| 1101 | blocksPerTenant: 100, |
| 1102 | }, |
| 1103 | { |
| 1104 | tenantCount: 1, |
| 1105 | blocksPerTenant: 1000, |
| 1106 | }, |
| 1107 | { |
| 1108 | tenantCount: 1, |
| 1109 | blocksPerTenant: 10000, |
| 1110 | }, |
| 1111 | { |
| 1112 | tenantCount: 1, |
| 1113 | blocksPerTenant: 100000, |
| 1114 | }, |
| 1115 | } |
| 1116 | |
| 1117 | for _, tc := range tests { |
| 1118 | previousPerTenant := newPerTenant(tc.tenantCount, tc.blocksPerTenant) |
| 1119 | previousPerTenantCompacted := newPerTenantCompacted(tc.tenantCount, tc.blocksPerTenant) |
| 1120 | |
| 1121 | // currentPerTenant := newPerTenant(uuids, tc.tenantCount, tc.blocksPerTenant) |
| 1122 | // currentPerTenantCompacted := newPerTenantCompacted(uuids, tc.tenantCount, tc.blocksPerTenant) |
| 1123 | currentPerTenant := maps.Clone(previousPerTenant) |
| 1124 | currentPerTenantCompacted := maps.Clone(previousPerTenantCompacted) |
| 1125 | |
| 1126 | var ( |
| 1127 | c = newMockCompactor(currentPerTenantCompacted, false) |
| 1128 | w = &backend.MockWriter{} |
| 1129 | s = &mockJobSharder{owns: true} |
| 1130 | r = newMockReader(currentPerTenant, currentPerTenantCompacted, false) |
| 1131 | previous = newBlocklist(previousPerTenant, previousPerTenantCompacted) |
| 1132 | ) |
| 1133 | |
| 1134 | // This mock reader returns error or nil based on the tenant ID |
| 1135 | poller := NewPoller(&PollerConfig{ |
| 1136 | PollConcurrency: testPollConcurrency, |
| 1137 | TenantPollConcurrency: testTenantPollConcurrency, |
| 1138 | PollFallback: testPollFallback, |
| 1139 | TenantIndexBuilders: testBuilders, |
| 1140 | }, s, r, c, w, log.NewNopLogger()) |
| 1141 | |
| 1142 | runName := fmt.Sprintf("%d-%d", tc.tenantCount, tc.blocksPerTenant) |
| 1143 | b.Run(runName, func(b *testing.B) { |
| 1144 | for tenant := range previousPerTenant { |
| 1145 | benchmarkPollTenant(b, poller, tenant, previous) |
| 1146 | } |
| 1147 | }) |
| 1148 | } |
| 1149 | } |
| 1150 | |
| 1151 | func BenchmarkFullPoller(b *testing.B) { |
nothing calls this directly
no test coverage detected