MarkMekhaiel

MarkMekhaiel

Help diagnosing 50x responses from a Phoenix app

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

Most Liked

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.

Where Next?

Popular in Questions Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: The documentation above suggests that while ...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

Other popular topics Top

danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29603 241
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 52673 488
New
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement