跳转到主要内容

AWP Profiling API

· 约 2 分钟阅读

概述

AWP Profiling API 提供异步 GPU/CPU 性能分析能力。用户提交采集任务后,后台自动采集并分析,通过查询接口获取结果。

  • Base URLhttps://awpai-backend.alibaba-inc.com
  • 认证:提交接口需 API Key(X-API-Key header);查询接口无需认证

核心流程

获取 API Key → 提交任务 → 轮询状态 → 拉取结果

状态流转:pending → running → finished → analyzing → completed(异常:failed / timeout / cancelled

接口列表

提交任务

POST /api/v1/profiling/awp_profiling

需要 X-API-Key 认证。请求体包含 target(目标 pod)和 config(采集配置)。

查询状态

GET /api/v1/profiling/awp_profiling/{profileId}

无需认证,建议 5-10s 间隔轮询。

查询结果(completed 后可用)

数据接口必填参数
TopKernelsGET .../awp_profiling/{id}/top_kernels?gpuId=<id>
Critical PathGET .../awp_profiling/{id}/critical_path?gpuId=<id>
Python 调用栈GET .../awp_profiling/{id}/python_result?gpuId=<id>
Perf EventGET .../awp_profiling/{id}/perf_event

Target 定位

podSN / podName / podIP 三选一(优先级 podSN > podName > podIP)。仅传 podIP 时后端自动反查补齐 nodeSN、podName、GPU 型号。

采集类型

类型用途推荐 duration
gpu_kernelGPU Kernel 性能分析20-30s
python_stackPython CPU 热点20-30s
off_cpu阻塞/IO/锁等待15-30s
perf_eventCPU 微架构(cache/branch 等)10-20s

可同时提交多种类型进行联合采集。

进阶选项

  • gpu_kernel.options.gpu_kernel_with_python: true:同时采集 Python 调用栈
  • perf_event.options.event:指定 perf 事件类型(默认 cpu-clock,可选 cycles/cache-misses 等)

错误码

HTTP含义处理
400参数错误按 message 定位
401API Key 无效/缺失重新生成
429限流Retry-After 退避
500后端异常联系团队

限流维度为 nodeSN + podSN/podName + jobID

使用示例

# 提交 GPU kernel 采集(20s,附带 Python 栈)
curl -X POST 'https://awpai-backend.alibaba-inc.com/api/v1/profiling/awp_profiling' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: <your-api-key>' \
  -d '{
    "target": { "podIP": "10.0.0.1", "jobID": "my-job" },
    "config": {
      "profilingTypes": ["gpu_kernel"],
      "gpu_kernel": {
        "duration": 20,
        "options": { "gpu_kernel_with_python": true, "python_duration": 10 }
      }
    }
  }'

# 查询状态
curl 'https://awpai-backend.alibaba-inc.com/api/v1/profiling/awp_profiling/{profileId}'

相关页面

修改历史
修改历史2 次提交