feat(go): add 100k ingest hardening baseline

This commit is contained in:
lingniu
2026-07-03 17:55:22 +08:00
parent 378a5d5e57
commit 79e591f864
20 changed files with 1360 additions and 2 deletions

View File

@@ -0,0 +1,18 @@
package loadsim
func ConnectionBatches(total int, ratePerSecond int) []int {
if total <= 0 || ratePerSecond <= 0 {
return nil
}
batches := make([]int, 0, (total+ratePerSecond-1)/ratePerSecond)
remaining := total
for remaining > 0 {
batch := ratePerSecond
if remaining < batch {
batch = remaining
}
batches = append(batches, batch)
remaining -= batch
}
return batches
}