Investigating LiteLLM memory growth and CPU spikes

A practical method for classifying LiteLLM memory and CPU problems as traffic-driven, upgrade-related, leaks or OOM events, reproducing them in a mirror environment, and collecting the evidence support needs.

On this page

Investigating LiteLLM memory growth and CPU spikes before you open a ticket

When a self-hosted LiteLLM gateway shows rising memory or sustained CPU spikes, the first decision is whether the cause is traffic, a regression or a leak. Answering that question before you escalate decides who investigates, what evidence you collect and whether a rollback is the fastest fix. This page gives you the triage path for that decision and the evidence support will need. Teams need this runbook when a pod's memory keeps climbing, CPU stays pinned during normal load, or the gateway changes behavior shortly after a release or configuration change.

LiteLLM's memory issues guide classifies memory problems into five patterns: growth that tracks traffic, growth without more traffic, growth after an upgrade, continuous leaks, and OOM events with restarts. Start by placing your symptom in one of these groups, using request rate, token volume and deployment history from the same time window. Growth that rises and falls with traffic is usually capacity. Growth that persists after load drops, or that starts on a specific release, points toward a regression or a leak. Confirm the exact release and worker count you run from your deployment manifests, because the guide's advice depends on both.

Before you open a ticket, check whether the pattern reproduces in a test environment that mirrors production in configuration, database and Redis topology, and representative traffic. Use the CPU issues guide alongside it to separate CPU saturation from a busy event loop or a blocked worker. Record per-pod memory and CPU over time, restart counts, worker count, the release, the configuration diff from the last change, and the timing of any OOM events. A reproducible test case with that evidence is the fastest route to a useful response from LiteLLM support or your own engineers.

Which of the five LiteLLM memory patterns are you seeing?

LiteLLM's memory troubleshooting guide sorts memory problems into five classes. The classes are separated by two questions: did traffic change, and did the software change. Pick the class that matches your timeline first, then follow the matching investigation path.

Traffic-driven growth

Memory rises in step with request volume, larger prompts or more concurrent streams, and falls back when load drops. The question that separates it from the other classes is whether memory tracks traffic. Start by lining up memory per worker against requests per second and average request size over the same window. If the curves move together and memory returns to a stable level after load drops, the gateway is sizing to demand and the next step is capacity planning, not a leak hunt.

Memory issues guide

Growth without more traffic

Memory climbs while request volume stays flat. The question is whether memory keeps rising after load is steady and unchanged. Compare memory against request count over a multi-day window and note whether the slope persists during quiet hours. Also record which features are active, such as logging callbacks, caches or large in-memory state, because flat traffic with rising memory usually points to something the gateway retains between requests.

Growth after an upgrade

Memory use changes noticeably after moving to a new release while traffic and configuration look the same. The question is whether the step change lines up with the deployment time. Record the exact image tag before and after the change, then compare memory per worker over the same traffic band. If the change appears only on the new version, reproduce it in a mirror environment on both versions before deciding whether to roll back, pin or move forward.

Continuous leaks

Memory rises steadily and never plateaus, regardless of load or version changes. The question is whether memory returns to a baseline after a worker or pod restart and then climbs again at a similar rate. Measure the rate of growth per hour after each restart. A consistent slope across restarts suggests memory that is never released, and the evidence needed for a support case is a sequence of memory samples across several restart cycles.

OOM events and restarts

Containers are killed for exceeding their memory limit, and the restart is the first visible symptom. The question is whether the kill is the root cause or the final step of one of the four patterns above. Check the last termination reason and exit status on each pod, then confirm whether restarts cluster on one worker, one node or all workers together. Memory limits set below the per-worker figure in LiteLLM's production guidance can produce kills without any leak.

Production best practices

How CPU spikes differ from memory growth in a LiteLLM gateway

Sustained CPU that stays elevated on each worker after traffic has settled points to work the gateway performs on every request or in a background loop. Check it per worker process, because LiteLLM's production guidance recommends one Uvicorn worker per pod on Kubernetes, which makes pod CPU and worker CPU nearly the same signal in that layout. The CPU troubleshooting page in the LiteLLM CPU issues guide is the reference point for this pattern.

  • Per-process view: Compare CPU for each worker against its share of requests, so a single busy worker stands out from the pod total.
  • Flat line after load drops: If CPU stays high while the request rate falls, treat the pattern as a candidate for a loop or background task.
  • Saturation against the limit: Compare sustained usage with the sizing in the production guide and check whether the pod metrics show throttling.
  • Dependency latency: Check whether CPU climbs as database or Redis calls slow down, since queued work can keep the gateway process busy.

Confirm whether the elevated CPU survives a restart on the same version and configuration, because that separates a workload problem from a regression.

Which question you answer first decides the classification

The triage starts at the symptom, memory growth or a CPU spike, and asks four questions in order: did traffic rise, did an upgrade land in the window, does memory keep climbing when traffic is flat, and are pods being OOMKilled. A yes on traffic points to traffic-driven load, an upgrade in the window points to a regression, and growth on flat traffic points to a leak or unbounded state. Each branch ends with the evidence to collect next, such as request rate, the upgrade change record, a memory trend over a quiet period, or the last termination reason. Work through the questions in this order before changing any configuration.

Decision path from symptom to classification and the next evidence to collect.

How to reproduce the problem in a mirror environment

This sequence builds a test environment that matches production closely enough to show the same memory or CPU growth shape, so any fix is tested against a problem that actually reproduces. It ends with a documented baseline that support and engineering can both reference.

  1. Record the production version and configuration

    Before building anything, capture the exact LiteLLM version, the container image digest, the Python dependencies in use, and the proxy config file with secrets removed. Note the worker count, pod resource limits, database and Redis versions, and every enabled callback or logging setting. Confirm the version against the releases page so the mirror runs the same build. Done when a single written record exists that another engineer could use to rebuild the environment without asking questions.

  2. Match the worker and pod layout

    Deploy the mirror with the same worker count per pod, the same Uvicorn worker model, the same replica count and the same memory and CPU limits as production. Scale the mirror down only if you can explain which differences could affect memory behavior. Done when a side-by-side comparison of the Kubernetes manifests or container runtime settings shows no unexplained differences.

  3. Mirror the database, Redis and model routes

    Provision PostgreSQL and, if production runs more than one proxy instance, Redis at the same major versions and with comparable settings. Load the same model routes, provider credentials pointed at test or sandbox endpoints where possible, and the same virtual keys, teams and budgets. Confirm that the routing config loads without errors and that each route answers a test request. Done when every production route has a working mirror equivalent and the database holds representative key and spend records.

  4. Build the traffic profile

    Derive the traffic profile from production metrics: request rate over the day, the mix of models, prompt and response size distribution, streaming versus non-streaming calls, and concurrency. Replay sanitized request logs if your data handling rules allow it, or generate synthetic traffic that matches those measured shapes. Label the synthetic profile as illustrative until it is checked against production numbers. Done when the load generator's rate and size distribution match the production baseline within a margin your team agrees on in advance.

  5. Capture the production growth shape first

    Using production dashboards or the memory and CPU samples your team already collects, plot resident memory and CPU per worker over a window that includes a known growth event. Classify the shape as traffic-driven, growth without added traffic, growth after an upgrade, continuous leak, or restart events. Done when you have a dated chart that shows the shape and the request volume at the same timestamps.

  6. Run the mirror and compare the growth shape

    Run the replayed or synthetic profile against the mirror for a window long enough to show the same shape as production, sampling memory and CPU at the same interval. Compare the curves for slope, plateau behavior, restart timing and per-worker divergence. Done when the mirror shows growth with the same classification as production. If it does not, adjust the profile or configuration before going further.

  7. Confirm the baseline before testing any fix

    Write down the reproduction recipe, the profile, the sampling interval, the version and the observed shape, then have a second engineer repeat the run from that record. Only after the second run matches should the team change code, settings or versions to test a fix. Done when the reproduction has been repeated with the same result and the baseline is stored where support and engineering can both find it.

Which investigation method fits each memory or CPU pattern

This table compares four investigation methods for LiteLLM memory and CPU problems, stating what each proves, what it cannot prove and when it fits. Read it by matching the symptom you see first to a row, then use the method in that row before concluding the cause.

MethodWhat it provesWhat it cannot proveWhen it fits
Memory per worker against request rateWhether memory tracks traffic, and whether it returns to a baseline after load fallsWhether growth is a leak, since traffic can explain a rising trend without any defectMemory climbs during busy hours and falls off-peak, or after a traffic increase
Memory growth with flat trafficThat memory rises while request volume and mix stay steady, which points away from load aloneThe specific allocation or object responsible, or whether a provider or callback is the triggerMemory keeps rising overnight or on weekends with no matching traffic
Before and after upgrade in the mirrorWhether the new release changes memory or CPU under the same replayed workload and configurationBehavior under production traffic shapes or data volumes that the mirror does not reproduceGrowth or CPU change began right after a version change and the mirror mirrors production settings
Long-running soak testWhether memory or CPU trends upward over many hours at a steady load, which is the evidence for a continuous leakProduction behavior during bursts, provider failures or unusual request sizesGrowth is slow and linear, and you need to confirm a leak before filing a defect report
CPU profile captured during a spikeWhich code paths consumed CPU at the moment of the spikeWhether the spike recurs, how often, or whether it is caused by traffic volume rather than codeCPU saturates on a worker and the cause is not obvious from request metrics
Restart and OOM event reviewThat a worker or pod was killed for memory and when it happened relative to loadThe memory trajectory before the kill unless metrics were recorded continuouslyPods restart with OOMKilled status and you need the timeline for the support ticket

What metrics and samples support will ask for

Why does support ask for memory and CPU per worker and per pod over time?

Support needs the time series, not a single reading, because the shape of the curve separates a steady climb from a traffic spike. Collect resident memory and CPU for each pod and for each worker process, covering at least the period from a quiet baseline through the incident. Per-worker data matters because one worker that grows while the others stay flat points at a different cause than a uniform rise across the whole pod. Export the data from your metrics system as a CSV or a dashboard snapshot with the time range visible, so the engineer reading it can line it up with deploys, traffic and restarts.

Which restart counts and OOMKilled reasons should I capture?

Capture the restart count per pod and the last termination reason, reported by Kubernetes as the container's last state, along with the exit code and timestamps. An OOMKilled reason tells support the kernel stopped the process for exceeding its memory limit, while other reasons point to crashes or failed probes. Pull this with kubectl describe pod and keep the output, because the last state is lost once the pod is replaced. Record which pods restarted together, since simultaneous restarts usually indicate a shared trigger rather than independent leaks.

What request rate and concurrency numbers do engineers need?

Engineers need request rate, in-flight concurrency and token throughput for the same window as the memory and CPU series. Traffic-driven growth correlates with these numbers, while growth without more traffic does not. Include the number of requests per model and per key if your gateway exposes them, because a single large-context client can explain a spike that the aggregate hides. Note any load tests or batch jobs that ran during the window, since they are often the answer.

Why does the configured worker count matter for memory?

The configured worker count sets how many copies of the proxy run inside each pod, so it multiplies the memory footprint. Record the worker count from the start command or configuration, the replica count, and the memory limit on the container. LiteLLM's production guidance recommends one Uvicorn worker per pod on Kubernetes and scaling horizontally, so a pod running several workers departs from that layout and should be stated explicitly in the ticket. Confirm the current recommendation for your release in the production guide before changing it.

Which LiteLLM and Python versions should I report?

Report the exact LiteLLM release tag, the image digest and the Python version inside the running container. Memory behavior changes between releases, so a regression after an upgrade is only provable when the old and new versions are named. Get the LiteLLM version from the running container with the package metadata or the image tag, and record when the image was last rolled. Also note any dependency pins you added, such as custom provider packages, because they change the process footprint. If you are unsure which release line you run, compare it against the supported minor versions in the enterprise documentation.

How do I capture callbacks and logging level without leaving debug on?

List every enabled callback and the current log level, then return production logging to its normal level once the sample is taken. Debug and detailed debug output add work on every request, and that work can itself raise memory and CPU, so a debug-enabled window can mislead the investigation. Record the settings from the configuration file and the environment, including any logging variables, and save a copy with the incident. If you need verbose logs, enable them on a single pod or in the mirror environment for a bounded period, then revert and note the times in the ticket.

What database and Redis health should be included in the window?

Include PostgreSQL and Redis health for the same period, because a stalled database or cache can hold requests open and build memory in the gateway. Collect connection counts, query latency, lock waits and CPU for PostgreSQL, and memory, evictions and latency for Redis. Redis is required once more than one proxy instance runs, so its state should be checked alongside the proxy. A flat database and cache during a gateway memory spike makes the gateway a stronger suspect, while a database slowdown that starts first moves the investigation outward.

Which profile or heap samples are worth capturing, and how?

Capture heap or CPU profile samples only from a pod that is already growing, and only with the tooling your team has agreed on, because profiling adds overhead and can change the behavior under study. Take two heap snapshots a fixed interval apart so the growing allocations can be compared, and label each with the pod, worker, version and time. Store them with the restart and metrics evidence. Confirm the sampling method with LiteLLM support before using it on a production pod, and keep the raw files because they are hard to reproduce later.

Setting up the investigation: a sequence with checks

This sequence fixes what is running, when the problem happened and what normal looked like, so the team can classify the memory or CPU pattern and reproduce it before changing anything. It ends with an evidence bundle that support and the engineering team can both read.

  1. Freeze the current version and configuration

    The platform engineer records the exact LiteLLM image tag, the Python package version if the SDK is involved, the proxy configuration file, the environment variables and the worker and replica counts per pod. Store the snapshot in version control or a change record so it cannot drift during the investigation. Do not restart pods or change settings until this snapshot exists. The step is done when someone other than the author can read the snapshot and identify the running build from it. Confirm the version against the LiteLLM releases page, since the current release line determines which upstream fixes apply.

  2. Record the time window of the symptom

    Write down when memory or CPU first left its normal range, when it peaked, and when pods restarted or were killed. Use the start and end times from the metrics system and the pod event log, in one time zone, and note whether the window is continuous or repeated. Check that this timeline lines up with any deploy, configuration change, provider incident or traffic change in the same period. If the timeline does not match any change, record that as a finding, because it points toward a leak or a slow resource buildup rather than a release. The step is done when the window and its change events sit on one shared timeline.

  3. Capture baseline metrics before the incident

    Pull memory, CPU, request rate, latency, error rate and restart counts for the same gateway over a period when behavior was normal, such as the release before the upgrade or a quiet weekday. Compare requests per second and token volume against memory and CPU, because growth that tracks traffic has a different cause than growth that does not. Include database connection counts and Redis health if they run alongside the gateway, since they can change memory use indirectly. The step is done when you can state whether memory per worker rose with load or stayed flat while load was steady.

  4. Classify the pattern against the five categories

    LiteLLM's memory troubleshooting guidance groups problems into five patterns: growth that follows traffic, growth without a matching rise in traffic, growth that starts after an upgrade, continuous leaks, and out-of-memory events with restarts. Assign the observed behavior to one or more of these, using the baseline and the timeline from the earlier steps. Add CPU findings separately, because CPU spikes may come from a different path, such as request parsing, logging volume or a single busy worker. The step is done when the team writes down one primary classification, the evidence behind it, and what would contradict it.

  5. Reproduce the pattern in a mirror environment

    The engineering team runs the same frozen version and configuration in a test environment that mirrors production in its topology, worker layout, database and Redis setup, and provider routes. Replay traffic that matches the production shape, using recorded request sizes and concurrency where possible, and watch memory and CPU for the same pattern. Use the upgrade path too, by running the prior and current versions side by side if the classification points to an upgrade. The step is done when the pattern reproduces, or when the team has recorded precisely where the mirror differs from production, so that gap becomes part of the next step. Ask the vendor or your own platform team to confirm which production settings matter for the mirror.

  6. Assemble the evidence bundle for support

    Package the frozen snapshot, the timeline, the baseline and incident metrics, the classification with its reasoning, the mirror results, and the relevant pod logs from before and after each restart. Include worker-level memory and CPU samples, the request mix during the window, and any profiling output the team captured. Mark which items were redacted and confirm the bundle does not contain prompts, keys or personal data. The step is done when a support engineer can reproduce the context from the bundle alone without asking the team for the first set of facts again.

Security and operational cautions while collecting samples

Profiles, logs and heap samples are the evidence that makes a memory or CPU investigation work, and they are also the easiest place for secrets and personal data to leak. The cards below cover what to strip before sharing, where the master key lives, how much load diagnostic settings add, and who can reach the mirror.

Redact prompts and payloads

Heap dumps, profiles and request logs can contain prompt text, model responses, API keys and personal data that passed through the gateway. Before any sample leaves the environment, check whether debug output captured request or response bodies and strip them. Confirm with your privacy and security teams which fields may be shared with an external support channel, and share only the sample set they approve.

Memory issues guide

Keep the master key out of tickets

LITELLM_MASTER_KEY must start with sk- and grants administrative control over the gateway, so it should never appear in a pasted config, process listing, log excerpt or support ticket. Keep it in a secret manager and reference it by name when you describe the deployment. Rotate it if a sample or screenshot may have exposed it, and confirm the rotation procedure with your team before you need it.

Production best practices

Turn debug logging back off

Detailed debug logging helps explain a memory or CPU pattern, but it adds its own work on every request and can make the symptom you are measuring worse. Record the time each debug setting was enabled, collect the evidence inside that window, and restore the production log level afterward. Confirm the log level in the running pods, not only in the deployment manifest, so you know what is actually active.

Limit access to the mirror

A test environment that reproduces production traffic often holds production-like prompts, keys or customer records, and it may be less tightly controlled than production. Restrict access to the people working the investigation, use the same identity controls as production, and remove copied data when the investigation closes. Ask who can read the mirror's logs, object storage and database snapshots before you copy anything into it.

Record who handled each sample

Every profile, log bundle and database extract should have a named owner, a storage location and a retention date so it can be found and deleted later. Without that record, copies spread through chat threads and shared drives and become hard to account for. Agree on one encrypted location for evidence, and ask your support provider how they store and delete the files you send them.

What does it cost and take to investigate LiteLLM memory and CPU issues?

How long does it take to classify a LiteLLM memory or CPU problem?

The time depends mostly on how much evidence you already have and whether a mirror environment is available to reproduce the problem. With per-pod memory and CPU history, deploy records and request volume for the same window, classification is usually a matter of checking which pattern fits. Without those, the work includes collecting data first and can take longer. No fixed duration applies, so ask for a timeline in the written scope after the evidence has been reviewed. Reproduction work in the mirror adds time on top of classification.

What are the main cost drivers for a LiteLLM memory investigation?

Three components drive most of the cost. The first is the mirror environment, which must resemble production closely enough to show the same growth, and which you either provision or pay for in your own cloud account. The second is load generation, meaning the tooling and time needed to replay representative traffic with comparable model routes and key configurations. The third is engineer time for reading metrics, comparing deploy history and testing hypotheses. Mirror and load costs are partly one-time setup and partly recurring while tests run. Ask any quote to itemize these three components separately.

What do we need to provide before an investigation starts?

The investigation needs read access to the metrics that show memory and CPU per pod or worker over time, along with request rate, latency and restart counts for the same period. It also needs your deploy and configuration history, including LiteLLM version changes, Helm or manifest revisions and changes to worker counts or database settings. Finally, it needs a safe place to replay traffic, which is usually a mirror environment in your own infrastructure with synthetic or sanitized prompts. Confirm with your security team how replayed data is handled before any production sample leaves your network.

Can our internal platform team investigate LiteLLM memory and CPU issues alone?

Yes, a team that runs Kubernetes and has access to the metrics listed in the previous answer can do the first stage of classification internally. The team can check whether growth follows traffic, whether it appears after an upgrade, whether memory keeps rising without more load, and whether restarts are OOM events. Reproduction in a mirror and collecting support-ready samples are harder to do without prior LiteLLM experience. Teams that lack spare capacity for a mirror or for repeated load tests often bring in a partner for those stages.

Which evidence should we collect before escalating to LiteLLM support?

Collect a timeline that marks the LiteLLM version, configuration changes, traffic volume and the first observed growth or spike. Include per-pod memory and CPU for the affected window, restart and OOM event records, and the worker and replica counts in effect. Add the database and Redis health for the same period, since stalled dependencies can look like gateway growth. LiteLLM's memory and CPU troubleshooting guides describe these categories, so use them to structure what you send. Redact keys and prompt content before sharing any sample.

When should we escalate a LiteLLM memory or CPU issue instead of continuing internally?

Escalate when the pattern persists after you have ruled out traffic and recent configuration changes, when a likely leak reproduces in a mirror, or when pods restart repeatedly in production and the cause is still unclear. Escalate also when a fix may require an upgrade to a newer release line, since your upgrade path and version support matter for that decision. Enterprise customers have a dedicated support channel and can review optional SLA terms in the Enterprise documentation. Confirm which channel applies to your license before the incident.

Does a memory investigation need access to production prompts or responses?

Usually no. Classification relies on resource metrics, restart records and configuration history, which do not require prompt content. Reproduction should use synthetic or sanitized traffic in a mirror environment that you control. If an engineer needs a production sample, limit it to what the issue requires, store it in an approved location and remove it after the investigation. Agree these handling rules in writing before the work starts, since prompts may contain personal or confidential data.

How DeployOpen works on this

DeployOpen approaches memory growth and CPU spikes in a self-hosted LiteLLM gateway as a written, fixed-scope investigation inside your own infrastructure. We start by classifying the symptom and collecting evidence, then reproduce it in a mirror environment before recommending any change.

How we scope

  • Confirm which symptom applies: traffic-driven growth, growth without more traffic, growth after an upgrade, a continuous leak, or OOM restarts
  • Agree in writing which LiteLLM version, deployment platform, database and Redis setup, and workloads are in the investigation
  • Define the metrics, time windows and sample types the investigation will collect and who in your team provides access

How we build

  • Build a test environment that mirrors production configuration so memory and CPU behavior can be reproduced under controlled load
  • Run the reproduction with your traffic pattern and record whether growth follows request volume, upgrades or configuration changes
  • Test candidate fixes such as version changes, worker layout or configuration adjustments in the mirror before any change reaches production

How we hand over

  • Deliver a written findings report that classifies the problem, shows the evidence and states what was reproduced and what was not
  • Document the metrics, dashboards and sample collection steps your team can repeat during future incidents
  • Provide a support package listing the data to attach to a provider or LiteLLM ticket, so escalation starts with complete evidence

How we support

  • Engagements are fixed-scope, so the deliverables and timeline are agreed in writing before the investigation starts
  • Ongoing support, upgrades and continuous testing are available as a retainer if memory or CPU behavior needs monitoring over time
  • Ask for a quote based on the written scope, which should name the environments, load tests and deliverables included

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.