test(panel): scale item-22 benchmarks to 20-server seed
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
package main
|
||||
|
||||
// Benchmarks for round-3 item 22 (per-request full-clone cost). Not run
|
||||
// by `go test` without -bench. The seed is synthetic data at production
|
||||
// scale (~11 servers / 26 customers / 25 nodes / ~100 bindings).
|
||||
// by `go test` without -bench. The seed is synthetic data at the scale
|
||||
// fixed for this round's acceptance: 20 servers / 40 customers /
|
||||
// 40 nodes / ~160 bindings (20-agent steady-state tests use the same
|
||||
// scale).
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
@@ -16,14 +18,14 @@ import (
|
||||
func perfSeedData() *Data {
|
||||
d := EmptyData()
|
||||
d.Users = []*User{{ID: "usr_1", Username: "admin", PasswordHash: "x", Role: "owner", Status: "active", CreatedAt: NowISO()}}
|
||||
for i := 0; i < 11; i++ {
|
||||
for i := 0; i < 20; i++ {
|
||||
d.Servers = append(d.Servers, &Server{
|
||||
ID: fmt.Sprintf("srv_%d", i), Name: fmt.Sprintf("S%d", i), PublicAddress: "203.0.113.1",
|
||||
Status: "online", LastSeenAt: StrPtr(NowISO()), PortRangeStart: 20000, PortRangeEnd: 50000,
|
||||
Labels: []string{}, CreatedAt: NowISO(), UpdatedAt: NowISO(),
|
||||
})
|
||||
}
|
||||
for i := 0; i < 26; i++ {
|
||||
for i := 0; i < 40; i++ {
|
||||
d.Customers = append(d.Customers, &Customer{
|
||||
ID: fmt.Sprintf("cus_%d", i), Name: fmt.Sprintf("C%d", i), Status: "active",
|
||||
SubscriptionToken: fmt.Sprintf("tok-%032d", i),
|
||||
@@ -32,9 +34,9 @@ func perfSeedData() *Data {
|
||||
})
|
||||
}
|
||||
protocols := []string{"vless-reality-vision", "shadowsocks-2022-aes128", "socks5-auth", "vless-ws", "hysteria2"}
|
||||
for i := 0; i < 25; i++ {
|
||||
for i := 0; i < 40; i++ {
|
||||
node := &Node{
|
||||
ID: fmt.Sprintf("nod_%d", i), Name: fmt.Sprintf("N%d", i), ServerID: fmt.Sprintf("srv_%d", i%11),
|
||||
ID: fmt.Sprintf("nod_%d", i), Name: fmt.Sprintf("N%d", i), ServerID: fmt.Sprintf("srv_%d", i%20),
|
||||
Protocol: protocols[i%len(protocols)], Topology: "direct", NetworkMode: "ipv4", Port: 23000 + i,
|
||||
Status: "active", ResourceID: fmt.Sprintf("res_%d", i), Artifacts: map[string]json.RawMessage{},
|
||||
}
|
||||
@@ -48,7 +50,7 @@ func perfSeedData() *Data {
|
||||
for j := 0; j < 4; j++ {
|
||||
d.NodeClients = append(d.NodeClients, &NodeClient{
|
||||
ID: fmt.Sprintf("nc_%d_%d", i, j), NodeID: node.ID,
|
||||
CustomerID: fmt.Sprintf("cus_%d", (i+j)%26), Status: "active",
|
||||
CustomerID: fmt.Sprintf("cus_%d", (i+j)%40), Status: "active",
|
||||
CreatedAt: NowISO(), UpdatedAt: NowISO(),
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user