Intermittent 30s-200s API response delays with low CPU/memory
miggalvez
HOBBYOP

2 hours ago

We’re seeing what looks like the same pattern on our Railway-hosted Express/Node backend.

Region/platform: Railway app service with MongoDB Atlas backend

Started noticing: after our June 3 deploy, but symptoms continued well beyond normal warmup.

Symptoms:

  • Intermittent very slow API responses, especially authenticated writes/actions.
  • POST /api/auth/login took 15s and later 42s.
  • POST /api/forms/:id/publish took 42s.
  • PATCH /api/forms/:id/draft/autosave took 85s and returned 409.
  • One public form submit took 36s; another took 282s and ended as client closed/499.
  • Several auth refresh requests logged 499s after 17s-107s.
  • CPU and memory were very low during the window: roughly 0.02 vCPU and ~400 MB RAM on an 8 GB limit.
  • Live health checks were fast before/after the slow cluster.
  • MongoDB Atlas looked healthy from our side: ping/query timings around tens of ms, no active long-running ops, no index builds, small collections.

We also saw lots of long /socket.io/ polling/upgrade requests, which can distort aggregate HTTP percentiles, but the raw REST logs show real slow login/publish/form-submit requests too.

This does not look like sustained app CPU/RAM pressure, database saturation, or normal post-deploy warmup. It feels like intermittent ingress/proxy/network delay or request handling delay outside the obvious app resource metrics.

Railway status currently says operational, so I’m mainly adding this as another datapoint: low app resource usage, healthy DB checks, but sporadic 30s-200s API waits on POST/PATCH/auth flows. Happy to provide timestamps/deployment IDs if helpful.

$10 Bounty

1 Replies

Railway
BOT

2 hours ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway about 2 hours ago


dev-charles254
PROTop 5% Contributor

an hour ago

Check your Railway HTTP logs for totalDuration vs upstreamRqDuration. If totalDuration is much higher, the delay is in Railway's proxy—redeploy to a different region and force WebSocket transport for socket.io. If they're equal, the delay is in your app: set waitQueueTimeoutMS: 5000 in your MongoDB connection options to prevent connection pool queueing, and add a simple request timing middleware to pinpoint slow routes.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...