Website frequently timing out and showing 502 errors

Hi everyone,
I’m hosting my restaurant-focused website on Kinsta it mainly features Texas Roadhouse menu updates, food reviews, and restaurant guides. The site has been performing well for the past few months, but recently, I’ve been running into serious performance issues. During peak traffic hours (especially weekends), users report slow load times, and sometimes the site throws 502 or 504 gateway errors. It’s intermittent but happens often enough to affect user experience and SEO rankings.

When I check the Kinsta dashboard, I can see CPU usage spiking close to 100%, and PHP workers occasionally max out. I’ve tried increasing the number of PHP workers by upgrading my plan, which temporarily improved things, but the issue returned a few days later. What’s odd is that the traffic volume hasn’t changed drastically — I’m averaging about 10k visits per day, mostly organic from Google. The slowdowns seem to coincide with bursts of simultaneous requests to my “Texas Roadhouse Early Dine Menu” and “Coupons” pages, which both use dynamic queries from my WordPress database.

I’ve already taken some optimization steps. I’ve enabled full-page caching in Kinsta, optimized my images with WebP, and added a CDN through Cloudflare. However, I still see large spikes in Time to First Byte (TTFB), sometimes over 3 seconds. The site uses the Rank Math SEO plugin and a few restaurant menu plugins that rely on custom post types and REST API calls could these be causing database bottlenecks or excessive queries during cache refresh?

Looking at the access logs, there are occasional bursts of requests from the same IPs, mostly from mobile users, which makes me wonder if some script or caching conflict is triggering unnecessary regeneration of cached pages. I’m also seeing recurring database queries in Query Monitor that take several seconds to complete. They seem related to fetching dynamic restaurant menu data and coupons. I’ve already tried enabling Object Cache, but I’m not sure if Redis would make a big difference here or if I should be using something else entirely.

I also ran a GTmetrix and Kinsta APM report, and both point to long PHP execution times during peak hours. My hosting plan currently uses PHP 8.2, and I’ve confirmed that plugins and themes are all compatible. I’m just unsure whether the bottleneck is from WordPress itself, the plugins, or the MySQL database under load. The APM traces show frequent “admin-ajax.php” calls, which might also be a contributor.

Has anyone here experienced similar 502 errors or sudden slowdowns despite caching being enabled? Should I be looking into Redis Object Cache or limiting backend API requests to stabilize performance? I’d love to hear how other Kinsta users have optimized dynamic WordPress sites with frequent content updates especially ones that rely heavily on menus or data-driven pages. Sorry for the long post!

Hi Joe!

I’m sorry to hear you’re facing these problems!

Anybody is welcome to chime in, but I wanted to let you know our Support team can help you look into this. It’s possible the cause may end up being something outside of our scope of support to resolve, but we can do things like:

  • Checking to see if there is any issue with the server the site is on
  • Checking average PHP response times
  • Checking PHP thread usage
  • Checking cache hit ratios
  • Checking actual traffic reaching our server — sometimes this can be a lot more than tools like Google Analytics show

502 responses specifically have a few possible causes, but one of them is the PHP backlog being filled up with hundreds of requests. Once the backlog becomes completely full, requests start immediately returning HTTP 502. One of the common causes of this scenario are significant surges in traffic that overwhelm the available PHP threads.

I would encourage you to contact us so that we can take a look :folded_hands:

Thanks so much for the quick and detailed response I really appreciate it! That explanation about the PHP backlog and surges overwhelming available threads makes a lot of sense. I’ve noticed that the 502 errors usually appear when multiple users hit the dynamic “Early Dine Menu” and “Coupons” pages at once, so it’s very possible those pages are causing a sudden burst of concurrent requests that fill the queue.

I’ll definitely reach out to Kinsta Support so they can review the PHP thread usage, cache hit ratios, and any possible server-level issues. I’d also love to confirm whether the spikes I’m seeing in the dashboard actually reflect real traffic or some kind of automated scraping or prefetching behavior.

Hi @joeroot, that sounds like a good plan! :blush: Reaching out to our Support team is definitely the right move. They can take a deeper look at PHP worker usage, caching, and traffic patterns to pinpoint what’s happening behind those spikes. They’ll also be able to confirm if it’s genuine visitor traffic or automated activity.

Let us know if have any other questions or concerns.