workers-profiling

โดย cloudflare

วิเคราะห์โปรไฟล์หรือดีบักการใช้งาน CPU และการจัดสรรหน่วยความจำใน Cloudflare Workers และ Durable Objects ที่นำไปใช้งานแล้ว จากนั้นใช้ข้อมูลนี้เพื่อปรับโค้ดให้เหมาะสมยิ่งขึ้น

npx skills add https://github.com/cloudflare/skills --skill workers-profiling

Workers profiling

Find expensive functions or memory allocations in deployed code and come up with ways to fix them.

Retrieve the docs

Start with the production profiling guide to understand how Workers and Durable Objects profiling works.

Profiling steps

  1. Identify the symptom and affected workload: CPU usage, latency, allocation pressure, or memory growth.
  2. Confirm the account, Worker, environment, and deployed version with the user.
  3. For a Durable Object, also confirm its owning Worker, namespace, and instance.
  4. Choose CPU or heap profiling from the current guide's supported types and meanings.

Where possible, use the cf CLI to capture profiles. If the user requests cf, inspect the installed version's command help and schema where available.

If cf isn't available, consider prompting the user whether they would like to install it.

The profiling API will return a pprof file which you can analyze directly, or using appropriate tools like Go's pprof utility.

Inspect the evidence

  • Read the pprof file and analyse it for hotspots
  • Map hotspots to functions and source locations when evidence supports it; report missing symbols or source mappings.
  • If filenames and function names are pointing at the generated JavaScript, consider suggesting to the user to enable source maps and re-do the profiling.

Optimise

Propose the smallest code change supported by the capture which resolves the issues identified.

Report findings

Return a concise report with:

  • Evidence for each finding: file, function, source location, and metric with units, where available.
  • The smallest actionable change and how to check its effect.

Skill feedback

If the user reports that this skill gave incorrect or outdated guidance, or is missing information, read references/skill-feedback.md.

Skills เพิ่มเติมจาก cloudflare

add-autogate
cloudflare
คู่มือทีละขั้นตอนสำหรับการเพิ่ม autogate ใหม่ให้กับ workerd เพื่อการเปิดตัวการเปลี่ยนแปลงที่มีความเสี่ยงแบบค่อยเป็นค่อยไป รวมถึงการลงทะเบียน enum การแมปสตริง รูปแบบการใช้งาน และ...
add-autogate
cloudflare
คำแนะนำทีละขั้นตอนสำหรับการเพิ่มออโตเกตใหม่ให้กับ workerd เพื่อการเปิดตัวการเปลี่ยนแปลงที่มีความเสี่ยงแบบค่อยเป็นค่อยไป รวมถึงการลงทะเบียน enum การแมปสตริง รูปแบบการใช้งาน และ…
add-compat-flag
cloudflare
คู่มือทีละขั้นตอนสำหรับการเพิ่มแฟล็กความเข้ากันได้ใหม่ให้กับ workerd รวมถึง schema capnp, การใช้งาน C++, การทดสอบ และข้อกำหนดด้านเอกสาร
add-compat-flag
cloudflare
คู่มือทีละขั้นตอนสำหรับการเพิ่ม compatibility flag ใหม่ให้กับ workerd รวมถึงข้อกำหนดเกี่ยวกับ capnp schema, การใช้งาน C++, การทดสอบ และเอกสารประกอบ
agents-sdk
cloudflare
สร้าง AI agent บน Cloudflare Workers โดยใช้ Agents SDK โหลดเมื่อสร้าง stateful agent, durable workflow, แอป WebSocket แบบเรียลไทม์, งานตามกำหนดเวลา,…
architecture
cloudflare
ใช้เมื่อนำทางในโค้ดเบสเป็นครั้งแรก เพิ่มเมธอดไคลเอ็นต์ใหม่ เพิ่มคอนเทนเนอร์แฮนเดลเลอร์/บริการใหม่ หรือทำความเข้าใจการไหลของคำขอ...
basin
cloudflare
สร้างและแก้ไขปัญหาเวิร์กโฟลว์การวิเคราะห์ข้อมูลของ Cloudflare Basin ด้วย Basin Pipelines, Basin Catalog และ Basin SQL ใช้สำหรับสตรีมข้อมูลไปยังตาราง R2 Iceberg จัดการแค็ตตาล็อก หรือสืบค้นตารางเหล่านั้น รวมถึงใช้กับคำขอที่ใช้ชื่อเดิมว่า Data Platform, Pipelines, R2 Data Catalog หรือ R2 SQL
data-analysisawsdatabase
bazel-test-hygiene
cloudflare
กฎบังคับสำหรับการรันการทดสอบ bazel ระหว่างการพัฒนา โหลดสกิลนี้ก่อนรันคำสั่งทดสอบ bazel ใดๆ โดยเฉพาะเมื่อตรวจสอบการแก้ไขหรือ…