AgentSkillsCN

cloud-run-benchmark

借助此技能,可对Cloud Run的存储性能(GCS、NFS、缓存或合成I/O)进行基准测试。支持稳健的验证流程、JSON格式的报告输出以及资源清理操作,是生产环境上线前验证架构决策的理想选择。

SKILL.md
--- frontmatter
name: cloud-run-benchmark
description: Use this skill to benchmark Cloud Run storage performance (GCS, NFS, cache, or synthetic I/O). Supports robust verification, JSON reporting, and resource cleanup. Ideal for validating architecture decisions before production.

Cloud Run Benchmark Skill

This skill provides a robust, verifiable workflow for benchmarking storage performance on Google Cloud Run. It automates the lifecycle of testing: Verification -> Deployment -> Benchmarking -> Reporting -> Cleanup.

Core Capabilities

  1. Storage Testing: Compare GCS Fuse, Direct VPC, and NFS.
  2. Synthetic Benchmarking: Test maximum container I/O using synthetic data generator (no external files needed).
  3. Robust Reporting: Generates JSON & Markdown reports for auditability.
  4. Auto-Cleanup: Ensures no expensive resources are left running.

Benchmarking Workflow

1. Build Loader Image

First, ensure the benchmark container image is available:

bash
bash scripts/build_loader.sh

2. Run Benchmark

Use the unified benchmark_cloud_run.sh script.

Scenario A: Synthetic I/O Test (No Dependencies)

Test raw container throughput without bucket/model dependencies.

bash
bash scripts/benchmark_cloud_run.sh \
  --service-name=bench-synthetic \
  --synthetic \
  --size-gb=10 \
  --cpu=4 --memory=8Gi

Scenario B: Real Model Loading (GCS + Direct VPC)

Test actual model loading performance.

bash
bash scripts/benchmark_cloud_run.sh \
  --type=gcs-vpc \
  --bucket=MY_BUCKET \
  --vpc=gpu-vpc \
  --model-file=models/llama-3-70b

Scenario C: NFS Performance

Test Cloud Filestore throughput.

bash
bash scripts/benchmark_cloud_run.sh \
  --type=nfs \
  --nfs-ip=10.0.0.2 \
  --file-share=model_share \
  --vpc=gpu-vpc

Configuration Reference

FlagDescriptionDefault
--typegcs, gcs-vpc, nfs (Ignored if --synthetic)gcs
--syntheticGenerate data in-memory instead of reading filesfalse
--size-gbSize of synthetic data to generate10
--no-cleanupSkip deleting service after test (for debugging)false
--gpuNumber of GPUs (0 to disable)0

Advanced Patterns

For detailed architecture trade-offs and optimization techniques (e.g., chunk sizing, thread counts), see: Storage Patterns

Self-Iteration & Troubleshooting

  • Low Throughput?: Check references/storage_patterns.md for "Direct VPC" and "Multi-threaded Loading".
  • Deployment Failed?: Check benchmark_run.log for authentication or quota errors.
  • Zonal Errors?: If using GPU, try specifying --gpu-type or check gcloud run regions list.