Group
  • Performance

    Cut my server response times

    Profile slow endpoints, find where the time actually goes, and fix the top offenders.

    • Debug & fix
    • Improve quality
    • Intermediate
    • General

Free Prompt

Some of my endpoints feel slow, and I want to know exactly where the time goes and fix the worst offenders. First, measure. Add timing instrumentation (or use existing logs/middleware) to capture per-endpoint response times, and where the stack allows, break time down: database queries, external API calls, and application code. If live measurement isn't feasible, analyze the code paths statically and reason about the costs. Then investigate the slowest endpoints for the usual causes: 1. Sequential awaits: independent operations awaited one after another that could run in parallel with Promise.all. 2. N+1 database queries (list endpoints querying per row). If my ORM has eager loading, apply it. 3. Missing caching: data that changes rarely but is recomputed or refetched on every request. Add caching at the appropriate layer with a sensible TTL and an invalidation story. 4. External API calls in the request path: anything calling a third party synchronously that could be moved to a background job or cached. 5. Oversized responses: endpoints returning entire records or unfiltered lists when the client uses a fraction of the fields. Fix the top three to five offenders by impact, not everything at once. Don't add caching without an invalidation plan; stale data bugs are worse than slow responses. When done, report per endpoint: before/after timings and what changed.

What This Does / How This Helps

This profiles your endpoints, breaks down where response time goes, and fixes the top offenders: sequential awaits, N+1 queries, missing caching, and third-party calls in the request path. Slow server responses compound across every interaction, and they're usually not one big problem but five boring ones. The sequential-await pattern is nearly universal in AI-generated code: three independent queries awaited in a row, tripling latency for free. Fixing the top few endpoints by measurement, rather than optimizing randomly, is what keeps this a two-hour task instead of a two-week one.

Want to skip doing this by hand?

Fortivibe audits your app for all of the areas these prompts cover (and more).

See What We Check

Related Prompts