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
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.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









