workers-profiling

Analise o perfil ou depure o uso da CPU e a alocação de memória em Cloudflare Workers e Durable Objects implantados. Em seguida, use essas informações para otimizar seu código.

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.

Mais skills de cloudflare

add-autogate
cloudflare
Guia passo a passo para adicionar um novo autogate ao workerd para implantação gradual de mudanças arriscadas, incluindo registro de enum, mapeamento de strings, padrão de uso e…
add-autogate
cloudflare
Guia passo a passo para adicionar um novo autogate ao workerd para implantação gradual de mudanças arriscadas, incluindo registro de enum, mapeamento de strings, padrão de uso e…
add-compat-flag
cloudflare
Guia passo a passo para adicionar uma nova flag de compatibilidade ao workerd, incluindo esquema capnp, uso em C++, testes e requisitos de documentação.
add-compat-flag
cloudflare
Guia passo a passo para adicionar uma nova flag de compatibilidade ao workerd, incluindo esquema capnp, uso em C++, testes e requisitos de documentação.
agents-sdk
cloudflare
Construa agentes de IA no Cloudflare Workers usando o Agents SDK. Carregue ao criar agentes com estado, fluxos de trabalho duráveis, aplicativos WebSocket em tempo real, tarefas agendadas,…
architecture
cloudflare
Use ao navegar pelo código-fonte pela primeira vez
basin
cloudflare
Crie e solucione problemas em fluxos de trabalho de análise do Cloudflare Basin com Basin Pipelines, Basin Catalog e Basin SQL. Use para transmitir dados para tabelas Iceberg no R2, gerenciar catálogos ou consultar essas tabelas; use também para solicitações que mencionem os nomes anteriores Data Platform, Pipelines, R2 Data Catalog ou R2 SQL.
data-analysisawsdatabase
bazel-test-hygiene
cloudflare
Regras obrigatórias para executar testes bazel durante o desenvolvimento. Carregue esta skill antes de executar qualquer comando de teste bazel, especialmente ao validar correções ou…