5 篇文章带有标签 “wrk”

LLM 的基准测试

  • Ampere, Ada, or Hopper GPUs (e.g., A100, RTX 3090, RTX 4090, H100). Support for Turing GPUs (T4, RTX 2080) is coming soon, please use FlashAttention 1.x for Turing GPUs for now.
  • Datatype fp16 and bf16 (bf16 requires Ampere, Ada, or Hopper GPUs).
  • All head dimensions up to 256. Head dim > 192 backward requires A100/A800 or H100/H800.

Turing GPU T4 不支持,需要使用 FlashAttention 1.x,否则会报错 ❌:

data: {
  "text": "**NETWORK ERROR DUE TO HIGH TRAFFIC. PLEASE REGENERATE OR REFRESH THIS PAGE.**\n\n(FlashAttention only supports Ampere GPUs or newer.)", 
  "error_code": 50001
}

Tabby 的基准测试

  • 模型:TabbyML/DeepseekCoder-1.3B
docker run -d --gpus all -p 8080:8080 \
  -v /data/zhw/tabby/data:/data \
  tabbyml/tabby:latest \
  serve --model TabbyML/DeepseekCoder-1.3B \
  --device cuda --parallelism 12

\\n 不能写为 \n,否则会报错:Failed to parse the request body as JSON: segments.prefix: control character (\u0000-\u001F) found while parsing a string at line 2 column 0

  • 基准测试工具:wrk
  • 持续时间:1 分钟
  • 超时时间:10 秒

使用 wrk 对 FastAPI 上传和下载文件的基准测试

服务器 CPU 40核,内存 256G,操作系统 Ubuntu 20.04,Python3.9

wrk 的 lua 脚本:postfile_formdata.lua

wrk.method = "POST"
local f = io.open("postdata", "rb")
wrk.body   = f:read("*all")
wrk.headers["Content-Type"] = "multipart/form-data; boundary=gouchicao0123456789"

wrk 的 lua 脚本:postfile_json.lua

wrk.method = "POST"
local f = io.open("postdata.json", "rb")
wrk.body   = f:read("*all")
wrk.headers["Content-Type"] = "application/json"

/file_benchmarking/upload/binary/chunk/async_func/async_rw wrk -c100

FastAPI 上传和下载文件的基准测试

使用 FastAPI 实现了文件的上传和下载,部署服务使用了 uvicorn 和 gunicorn+uvicorn 两种方法。

基准测试工具使用的是 wrk

服务器 CPU 40核,内存 256G,操作系统 Ubuntu 20.04,Python3.9

stream 异步读取上传的文件,同步写入 tempfile.NamedTemporaryFile() 生成的文件。 http://172.16.33.159:8000/files/upload/stream/async_read_and_memory_write stream 异步读取上传的文件,同步写入磁盘文件。 http://172.16.33.159:8000/files/upload/stream/async_read_and_disk_write stream 异步读取上传的文件,异步写入磁盘文件。 http://172.16.33.159:8000/files/upload/stream/async_read_and_async_write 异步全量读取上传的文件,异步写入磁盘文件。 http://172.16.33.159:8000/files/upload/single 异步全量读取上传的文件,异步写入磁盘文件。(API 函数定义时没有使用 async) http://172.16.33.

HTTP 基准测试工具

可以编写个程序按上面的格式生成二进制的文件数据

我这里生成的数据:postdata

--1234567890^M
Content-Disposition: form-data; name="file"; filename="test.jpg"^M
Content-type: image/jpeg^M
^M
iVBORw0KGgoAAAANSUhEUgAACl4AAAesCAIAAABa4uohAAAACXBIWXMAAAsTAAALEwEAmpwYAAAgAElEQVR4nOzdfXyTZZ73/V/ShIZSSgqVxtpiaBE6SzuUgrNIFYGWBcW9R……..^M
--1234567890--^M
  • Ubuntu
apt install apache2-utils -y
ab -p user.json -T "application/json" http://127.0.0.1:8000/users