Can all registered uses please login, even just for a few minutes..
It helps build a picture where our "good traffic" is coming from..
Thanks :)

nginx connections puzzle

This chat forum will appear to guests and bots. IE will appear on search engines etc. If you do not want your appearing publicly then please use the original chat forum.
Post Reply
User avatar
exxos
Site Admin
Site Admin
Posts: 28659
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

nginx connections puzzle

Post by exxos »

Odd one for anyone who fancies a puzzle. My nginx connection count sat spiky between 300 and 1200 per minute for about a week, then dropped to a flat 100 at 11am one morning and has stayed there since.

Ruled out, in order:

Traffic drop. Request volume was identical either side, 4,216 at 11:00 against 4,493 at 12:00. Distinct IPs actually went up, 2,818 to 3,297.

A single source leaving. Compared five minute windows either side. Only one IP vanished and it accounted for 28 requests, nowhere near enough.

Nginx restarting. Last start was three days earlier, nothing in the journal for that window.

An attack holding sockets open. All connections were idle keep-alive with empty send and receive queues. client_header_timeout is 5 seconds with reset_timedout_connection on, so a connection that opens and sends nothing is killed almost immediately, it cannot accumulate.

The metric being wrong. Cross-checked stub_status against ss three times, they agree within about ten. It is a genuine peak across sixty one-second samples, not a single reading landing on a burst.

Squid, and a couple of specific crawlers. All steady across the drop.

The one thing that has trended alongside it is protocol mix. HTTP/2 was 93% of requests a week ago and is 33% now, with HTTP/1.1 taking up the slack. That fits fewer multiplexed browser sessions and proportionally more crawler traffic, and explains a gradual rise in connections, but not a cliff at 11am.

Everything that actually matters is healthy. PHP listen queue has been zero throughout and CPU peaks around 50%.

TL;DR: I keep seeing spikes of hundreds of nginx connections, but there is nothing in the logs showing what that traffic actually was. It looks like a botnet, except the logged request volume is identical between 10am and 12pm either side of the drop. So what were those connections doing? This one generally has me beat :(


Capture.PNG
Capture.PNG (182.55 KiB) Viewed 55 times
User avatar
exxos
Site Admin
Site Admin
Posts: 28659
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: nginx connections puzzle

Post by exxos »

I finally figured it out...

Capture.PNG
Capture.PNG (321.8 KiB) Viewed 44 times


The bottom rate spikes were PHP-FPM triggering.. So they SHOULD be in the log but not all of them was. :roll:

Seems at some point along the way they look problem was introduced into the nginx config :shrug: This *might* have been my own doing a while back for *reasons*.

So now my log is a lot more active now it has been fixed.. So it should be a lot more efficient in dealing with all the traffic now the log is actually showing what all the traffic is ! :stars:
User avatar
viking272
Site sponsor
Site sponsor
Posts: 290
Joined: Mon Aug 10, 2020 11:32 am
Location: Reading, Berkshire, UK

Re: nginx connections puzzle

Post by viking272 »

Do you run Claude Code?
It's extremely good with Linux and Nginx config. Claude has ssh access to my Nginx webserver. It writes queries to check and review config etc, I approve then it assesses the results and makes suggestions, I approve, and it writes the ssh code to connect, I approve and we move forward.
it doesn't have sudo, so I have to ssh to make those changes. Its very fast to make lots of changes.
My project builds are largely automated through git on the server, where it can deploy approved site-wide changes, hooks restart services and deployments or tweaks are quick. Any installs I do, then it verifies and confirms privileges are correct etc.
I had PHP-PFM 7 running and we upgraded to 8.4 as v7 is was deprecated in 2021 I think.
User avatar
exxos
Site Admin
Site Admin
Posts: 28659
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: nginx connections puzzle

Post by exxos »

viking272 wrote: Fri Aug 07, 2026 11:24 am Do you run Claude Code?
It's extremely good with Linux and Nginx config. Claude has ssh access to my Nginx webserver. It writes queries to check and review config etc, I approve then it assesses the results and makes suggestions, I approve, and it writes the ssh code to connect, I approve and we move forward.
it doesn't have sudo, so I have to ssh to make those changes. Its very fast to make lots of changes.
I've not had chance to look into it yet, but if Claude can connect to my server to run checks, that would make things 1,000% faster !

My project builds are largely automated through git on the server, where it can deploy approved site-wide changes, hooks restart services and deployments or tweaks are quick. Any installs I do, then it verifies and confirms privileges are correct etc.
I had PHP-PFM 7 running and we upgraded to 8.4 as v7 is was deprecated in 2021 I think.
Cool !
Post Reply

Return to “CHAT FORUM PUBLIC”