setup

command
v0.0.1-beta.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

setup 构造多租户压测数据(数据模型 + 计费字段 + intelligent routing 新契约):模板(四格式 × 随机模型池 + loadtest 固定请求模型必含)→ 公开组 → 账号(分散模板/组/上游,可选采购成本倍率 + 共享缓存域)→ 用户(可选 余额/并发区间)→ 逐个登录建 key(可选多 key/并发/额度区间),key 明文写文件 (loadtest -keys 用)。 -price-models 给随机 N 个模型 manual 定价(验证计费链路有价);-billing-enabled 一步到位:默认余额区间 + 全部模型池定价;-routing-rules 播种 typed 路由规则 (窗口 429 → throttle、窗口 5xx → fail_account,fatal 场景演练入口)。

用法: go run ./tools/loadtest/setup \
  -addr http://127.0.0.1:8080 -admin-jwt <platform_admin JWT> \
  -upstream http://127.0.0.1:9100 \
  -users 5000 -accounts 5000 -groups 20 -keys-out keys.txt \
  -cost-multiplier 0.5-4 -cache-domains 64 -routing-rules

说明:

  • 模板 base_url = -upstream(裸根约定:不含 /v1,服务端校验会拒绝尾 /v1); -upstreams 逗号分隔多上游时轮流分配(压测机跑多个 fakeup 实例不同端口)
  • 组全部 public(key 可选性无限制);账号 upstream_key 统一 "sk-upstream"
  • 用户密码统一 "loadtest-pass-1"(bcrypt 校验可验证)
  • key 并发/额度随机区间内取值,随机值 0 = 该 key 不设限制("随机挑选填充")
  • 账号只走 intelligent-routing 新契约(无 weight/status 旧字段):成本倍率和 缓存域均经 fenced PUT 更新(创建代际恒 1 直接命中);每第 4 个账号留私有 域做对照。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL