High latency on wordpress site
makorism
PROOP

2 months ago

Hi Railway team, I’m trying to debug intermittent high latency on a mostly simple WordPress site and would appreciate help understanding whether Railway sees anything unusual in the request path.

Architecture:

Cloudflare -> Railway public domain -> Caddy reverse proxy service -> WordPress service -> MariaDB

The public domain is personalizedgiftnewspaper.online. Caddy proxies to WordPress over Railway private networking. WordPress and MariaDB are in the same Railway region: europe-west4-drams3a.

The issue:

The site runs well locally, but deployed requests randomly slow down. It is especially noticeable when logged into WordPress admin, where I’m seeing 5s+ page/admin waits. This is not only static/front-end page load work; Railway HTTP logs show slow upstream durations on WordPress admin AJAX and normal GET requests.

I disabled caching/observability plugins to remove noise:

  • W3 Total Cache disabled
  • DecaLog disabled
  • Query Monitor disabled
  • W3TC drop-ins removed: advanced-cache.php, db.php, object-cache.php
  • Cloudflare cache off for the tested dynamic routes

Resource usage does not look saturated:

  • WordPress service max CPU around 0.55 vCPU / 24 vCPU
  • WordPress memory max around 1GB / 24GB
  • MariaDB max CPU around 0.048 vCPU / 8 vCPU
  • MariaDB memory around 304MB / 8GB
  • DB connect + SELECT 1 from WordPress is around 19-21ms

Clean no-cache baseline after disabling plugins:

  • GET /healthcheck.html: client 77-141ms, Railway upstream 3-58ms
  • GET /: client 996-1120ms, Railway upstream 863-902ms
  • GET /wp-login.php: client 479-584ms, Railway upstream 393-414ms
  • From inside Caddy container to WordPress through the local reverse proxy path:
    • /healthcheck.html: ~1ms
    • /: ~835-872ms
    • /wp-login.php: ~377-393ms

The important bit: for the slow requests, Railway’s totalDuration and upstreamRqDuration are basically identical, so the delay appears to be while Railway is waiting for the service chain to respond, not browser rendering or response transfer.

Examples of AJAX slowdowns:

2026-06-10T10:51:25Z POST /wp-admin/admin-ajax.php 200

totalDuration=6166ms upstreamRqDuration=6166ms requestId=SrW7DELoRBeLCxTN55So4g

2026-06-10T10:51:26Z POST /wp-admin/admin-ajax.php 200

totalDuration=6396ms upstreamRqDuration=6396ms requestId=Y1K7FFHIQFOXi4zvnbOCzg

Examples of normal request slowdowns:

2026-06-10T10:55:13Z GET / 200

totalDuration=1411ms upstreamRqDuration=1411ms requestId=xOdDdM1ARsqO-DSrWUN5dQ

2026-06-10T10:58:22Z GET / 200

totalDuration=1532ms upstreamRqDuration=1530ms requestId=VhZ594faSICYniLxAQeqjw

Routing context:

  • Cloudflare colo from my location: LHR
  • /.railway/cdn-trace on my domain: pop=ams1 node=aydy
  • railway.com trace from the same client: pop=lhr1 node=4rsz

Could someone from Railway check whether these request IDs show anything platform-side: private network stalls, routing/proxy behavior, container scheduling pauses, or anything odd in europe-west4-drams3a?

I’m also happy to run any specific diagnostic command Railway prefers.

I'm aware things like this are hard to diagnose and it could be something I've just incorrectly set up in my but it's just confusing given how smoothly the site runs locally. I've really tried everything and have been seeing this behaviour for months, just asking before I test if it runs better on another platform and all the infrastructure setup that comes with that.

Solved$20 Bounty

4 Replies

Railway
BOT

2 months ago

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

Status changed to Open Railway 2 months ago


inteliino
FREE

2 months ago

Thanks for sharing all the details. A couple of things I'd test next:

Bypass Caddy entirely and expose WordPress directly on a temporary Railway domain. If latency remains the same, Caddy can likely be ruled out.

Run repeated requests from inside the Caddy container directly to the WordPress container:

curl -w "\nconnect=%{time_connect} starttransfer=%{time_starttransfer} total=%{time_total}\n" -o /dev/null -s http://wordpress:PORT/

Compare the results during both fast and slow periods.

Temporarily switch to a default WordPress theme (Twenty Twenty-Five) and disable all plugins. This helps rule out theme or plugin-related performance issues.

Check whether the slow admin-ajax.php requests are associated with a specific action. A single plugin or heartbeat action is often responsible for these kinds of delays.

Run:

wp cron event list

and temporarily disable WP-Cron to see if scheduled background tasks are causing latency spikes.

If Railway support can inspect the request IDs, I'd be particularly interested in whether they see:

Container scheduling delays

Private networking latency

Proxy retries

Connection pool exhaustion

Cross-node routing anomalies

The fact that totalDuration and upstreamRqDuration are nearly identical suggests the request is spending most of its time waiting on the upstream service chain rather than at the Railway edge.

Based on the data provided so far, my suspicion would still be WordPress/PHP execution rather than Railway itself, but the tests above should make it much easier to confirm where the latency is actually occurring.


makorism
PROOP

6 days ago

Following up with stronger isolation evidence. I have now reproduced the latency without loading WordPress, PHP plugins, the theme, Caddy, Cloudflare or an HTTP request.

Project: 0a02c1bd-24dc-4646-93a6-5ede5f72bda6

Environment: production, 93be4200-eb88-4814-ac34-40927b224746

Region: europe-west4-drams3a

WordPress service: 8fbe860a-0437-4539-82d9-ae03278be9d2

MariaDB service: 48d1de1e-b7ed-4532-8cc3-47821d546f7d

From inside the WordPress service, I opened one raw mysqli connection to MariaDB’s private .railway.internal address. After the connection was established, I ran ten batches of twenty sequential SELECT 1 calls:

  • Connection: 22.93ms
  • Minimum query round trip: 5.158ms
  • Median: 5.200ms
  • p95: 5.381ms
  • Maximum: 5.602ms
  • Mean: 5.260ms

The identical test against local Docker MariaDB averages 0.053ms.

I also tested Redis from the same WordPress container using one authenticated persistent TCP connection to its private .railway.internal address:

  • Median PING: 5.760ms
  • Mean: 5.781ms
  • Maximum: 5.949ms

Seeing the same 5–6ms floor against both MariaDB and Redis suggests private-network round-trip latency rather than database execution or WordPress.

I have also verified:

  • Both services are in the same Railway region.
  • MariaDB has skip_name_resolve=ON.
  • The timed queries reuse an established connection.
  • MariaDB currently uses 1/151 connections; historical maximum is 45.
  • No resource saturation.
  • No active lock contention.
  • 99.9996% InnoDB buffer-pool hit rate.
  • DISABLE_WP_CRON=true.

WordPress makes approximately 125 sequential queries on these pages, so a 5.26ms round-trip floor alone accounts for roughly 658ms of request time.

Could Railway please check the placement and private-network route between these deployment instances and confirm whether a stable 5–6ms service-to-service round trip is expected in europe-west4-drams3a? The behaviour closely resembles this other report: https://station.railway.com/questions/my-sql-latency-issues-cdeea77b

If possible, could you also confirm whether the services are on different physical hosts or zones and whether rescheduling either service would be a useful diagnostic?


2 days ago

A single digit is expected, as we cannot guarantee workloads in the same region will all deploy to the same availability zone; your services are spread across our two zones. Unfortunately, I can't offer close colocation, as that is only available to Enterprise users at this time.


Status changed to Awaiting User Response Railway 2 days ago


brody

A single digit is expected, as we cannot guarantee workloads in the same region will all deploy to the same availability zone; your services are spread across our two zones. Unfortunately, I can't offer close colocation, as that is only available to Enterprise users at this time.

makorism
PROOP

an hour ago

Oh okay, that's a bit unfortunate but I guess makes sense. I'll have to accept some latency at present then as wordpress plugins all make a bunch of small calls on page load. I've reduced the number of calls as much as possible so hopefully caching can hide most of the page slowdown, might look for another hosting solution given how many calls wordpress needs to make to MySQL every page load. Thanks anyway.


Status changed to Awaiting Railway Response Railway about 1 hour ago


Status changed to Solved Railway about 1 hour ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...