workers-profiling

Profilkan atau debug penggunaan CPU dan alokasi memori pada Cloudflare Workers dan Durable Objects yang telah di-deploy. Kemudian, gunakan informasi ini untuk mengoptimalkan kode Anda.

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.

Lebih banyak skill dari cloudflare

add-autogate
cloudflare
Panduan langkah demi langkah untuk menambahkan autogate baru ke workerd untuk peluncuran bertahap perubahan berisiko, termasuk registrasi enum, pemetaan string, pola penggunaan, dan…
add-autogate
cloudflare
Panduan langkah demi langkah untuk menambahkan autogate baru ke workerd untuk peluncuran bertahap perubahan berisiko, termasuk registrasi enum, pemetaan string, pola penggunaan, dan…
add-compat-flag
cloudflare
Panduan langkah demi langkah untuk menambahkan bendera kompatibilitas baru ke workerd, termasuk skema capnp, penggunaan C++, pengujian, dan persyaratan dokumentasi.
add-compat-flag
cloudflare
Panduan langkah demi langkah untuk menambahkan flag kompatibilitas baru ke workerd, termasuk skema capnp, penggunaan C++, pengujian, dan persyaratan dokumentasi.
agents-sdk
cloudflare
Bangun agen AI di Cloudflare Workers menggunakan Agents SDK. Muat saat membuat agen stateful, alur kerja tahan lama, aplikasi WebSocket waktu nyata, tugas terjadwal,…
architecture
cloudflare
Gunakan saat menjelajahi basis kode untuk pertama kalinya, men
basin
cloudflare
Membangun dan memecahkan masalah alur kerja analitik Cloudflare Basin dengan Basin Pipelines, Basin Catalog, dan Basin SQL. Gunakan untuk mengalirkan data ke tabel R2 Iceberg, mengelola katalog, atau mengkueri tabel tersebut; gunakan juga untuk permintaan yang menggunakan nama lama Data Platform, Pipelines, R2 Data Catalog, atau R2 SQL.
data-analysisawsdatabase
bazel-test-hygiene
cloudflare
Aturan wajib untuk menjalankan pengujian bazel selama pengembangan. Muat skill ini sebelum menjalankan perintah pengujian bazel apa pun, terutama saat memvalidasi perbaikan atau…