MarkMekhaiel

MarkMekhaiel

Hi,

We’ve been hosting a phoenix application on AWS behind a load balancer for a number of years without issue. This acts as a server for our website and booking system.

Yesterday, for a period of 3 minutes, the site stopped responding, and after checking AWS logs, the load balancer responded with a combination of 502, 503 and 504 responses. Our phoenix application reported no errors.

After checking more AWS logs, it appears our CPU usage spiked to 95% just before the errors started being returned. Is there any way I can diagnose what caused this spike? The phoenix app reported no 50x responses in its error logs, so I’d assumed it was something at the load balancers end, but after looking at the CPU usage I’m guessing this is the cause?

Any help on the best way to diagnose CPU usage (if this is indeed the issue) is greatly appreciated

Showing Posts 1 to 2

D4no0

D4no0

I have my doubts that your app is the culprit, but it can happen.

I would check the telemetry if you didn’t have a huge inrush of clients or a ddos attack, as phoenix has a mechanism of dropping requests when it is no longer feasible to respond to them in time (I’m not entirely sure that it’s documented somewhere, as I’ve heard about it on this forum from @josevalim).

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

Yeah a 502 from a load balancer generally means “I can’t get a response from my backend servers”. Regarding the high CPU, unfortunately causes are going to be extremely varied. As someone already suggested, check the request rate and make sure you weren’t getting a request flood. Beyond that, hopefully you’re logging or recording enough system telemetry to see what’s up.

The other thing to check would be memory usage. I’ve seen cases where if you get some some sort of excessive multi-gigabyte processes that’s growing rapidly the garbage collection can use a LOT of CPU.

Finally, look at operations that may use NIFs or other explicitly CPU intensive operations. These are commonly things involving encryption like password hashing or any other sort of explicit crypto operation.

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
apz
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
New

Other Trending Topics Top

budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New
GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews