feat: Python(Locust) + Go(boomer) 混合压测框架(演示版)

This commit is contained in:
WbiubiuW
2026-09-22 21:35:03 +08:00
commit 26cdd4b5c1
63 changed files with 6171 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
package main
import (
"flag"
"log"
"github.com/myzhan/boomer"
)
func main() {
// 注意:boomer 在 init 里已注册 --master-host/--master-port 等 flag,
// 这里只新增自己的 flag,绝不能重复定义(会 panic)。
target := flag.String("target", "http://127.0.0.1:18099", "被测 mock 地址(只打本机)")
flag.Parse()
client := NewAPIClient(*target)
tasks := buildBoomerTasks(client)
log.Printf("[go-worker] target=%s, tasks=%d", *target, len(tasks))
boomer.Events.Subscribe("boomer:spawn", func(workers int, spawnRate float64) {
log.Printf("[go-worker] master asks to spawn %d workers (rate %.0f)", workers, spawnRate)
})
boomer.Run(tasks...)
}