Groups | Search | Server Info | Login | Register


Groups > rocksolid.programming > #323

Re: Server sends 502 status code, but site is fully operational. wtf ?

From Anonymous@rocksolidbbs.com (Anonymous)
Newsgroups rocksolid.programming
Subject Re: Server sends 502 status code, but site is fully operational. wtf ?
Date 2023-10-15 20:23 +0000
Organization RetroBBS
Message-ID <44bee2c94c169891b99548013b019e36@rocksolidbbs.com> (permalink)
References <b27edb809d5e14e4d8e5f7b0faea11d6@news.novabbs.org>

Show all headers | View raw


Anonymous wrote:

> Hope someone can shed some light on this, cause I'm really a little lost...

> I'm coding a website, consisting of some static files (images, css, and such) and some dynamic content in php.
> The server is nginx, and it uses php-fpm to link to php.

> Now I thought before I go live, I'd do a little stress testing just to see how it handles (hardware is an old 
> raspberry pi with 1G of RAM available, so I wasn't expecting much...).

> I used a little python script that generates a flood of randomized requests, and halfway expected the server to go down
> quickly and become unreachable. To my amazement, I found the site remained completely operational during the stress
> testing, both for static files (which are served directly by nginx), and also for the dynamic content generated by my
> php scripts. Happy with that result, I went on to see the server logs, and here came my surprise:
> the requests from the flooding tool generated a lot 502 status codes (bad gateway), indicating an overload on the php side.
> This I found also confirmed in the php logs ("server reached pm.max_children setting").
> In between the thousands of 502 status codes, there were the requests I did manually during the stress test with a browser,
> and they all had the status code 200 (OK), for the static files as well as for the dynamic content (and I could see the 
> content in the browser as well, so it was actually delivered).

> As I said, I kind of expected that I could take the server backend down (my php is probably not too efficient), and that
> was confirmed by the logs of the webserver and the php logs. But why did the site function at the same time and was delivering
> content (again confirmed by the logs) ? I would expect the site to be up or down, but not both at the same time.
> Have I created a Schroedingers site accidentally ?

> Happy to receive any comments or questions.

Is nginx throttling the flooding ip address, and maybe the ip address you're connecting from a different address?

I'm not sure if nginx does this by default, but it does have the ability to do so.

-- 
Posted on RetroBBS

Back to rocksolid.programming | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Server sends 502 status code, but site is fully operational. wtf ? Anonymous@news.novabbs.org (Anonymous) - 2023-10-15 20:02 +0000
  Re: Server sends 502 status code, but site is fully operational. wtf ? Anonymous@rocksolidbbs.com (Anonymous) - 2023-10-15 20:23 +0000
    Re: Server sends 502 status code, but site is fully operational. wtf ? Anonymous@rocksolidbbs.com (Anonymous) - 2023-10-16 06:43 +0000

csiph-web