Prompt

How do I tell if a slowdown is from code, database, or API?

Technology / Observability1 observationLast seen Oct 20, 2026

Latest observation

Oct 20, 2026OpenAI APIWeb search: off

A good way to tell is to measure each boundary separately and look for where the time accumulates.

Quick mental model

A request is usually slowed by one of these:

  • Code / app logic: CPU work, loops, serialization, locking, memory pressure
  • Database: slow queries, missing indexes, contention, too many round trips
  • External API: network latency, slow downstream service, retries, rate limits

A practical checklist

1) Split the request into timings

Add timing around each major step:

  • request start → app logic start
  • app logic before DB → after DB
  • before external API → after external API
  • response build → response sent

If you see:

  • Most time before any DB/API call → likely code
  • Most time inside DB calls → likely database
  • Most time inside HTTP/API calls → likely external API

2) Compare app time vs dependency time

Look at:

  • Total request time
  • Time spent in DB
  • Time spent in outbound API calls
  • CPU usage

Interpretation:

  • High request time, low DB/API time, high CPU → code problem
  • High request time, high DB time → database problem
  • High request time, high external call time → API problem

3) Check whether it scales with traffic

  • If slowdown gets worse with more traffic and CPU is high, it may be app code or DB contention.
  • If slowdown happens only on certain queries or endpoints, it may be a specific DB query or API call.
  • If latency is spiky and correlated with network errors/retries, it may be the API.

4) Look at failure patterns

  • Code: timeouts, memory spikes, GC pauses, thread pool exhaustion
  • Database: slow query logs, lock waits, deadlocks, high rows scanned
  • API: 429s, 5xxs, retries, connection timeouts, DNS/network issues

5) Use tracing if possible

Distributed tracing makes this much easier. A trace will show:

  • time in your service
  • time in DB
  • time in each outbound API call

Tools:

  • OpenTelemetry
  • Datadog APM
  • New Relic
  • Jaeger / Zipkin

Fast isolation tests

If you need a quick answer:

  • Disable or mock the external API: if latency disappears, it’s API-related
  • Run the DB query directly: if it’s slow standalone, it’s DB-related
  • Profile the app without DB/API calls: if still slow, it’s code-related

Rule of thumb

  • Slow before any dependency call = code
  • Slow during SQL = database
  • Slow during HTTP calls = external API

If you want, I can give you a simple step-by-step debugging flowchart or a sample logging/tracing setup to pinpoint this in your stack.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.