Welcome! Log In Create A New Profile

Advanced

Re: Disabling keepalive

Maxim Dounin
October 30, 2022 12:26AM
Hello!

On Fri, Oct 28, 2022 at 09:01:27AM -0400, libresco_27 wrote:

> Thanks for your answer!
> I have another query if we can actually see that keepalive is being disabled
> in nginx logs.
> Is it possible to confirm that if we run nginx in debug mode and if so, what
> kind of logs should I look for?

When keepalive with upstream servers is enabled, in the debug logs
there will be "get keepalive peer", "get keepalive peer: using
connection ...", "free keepalive peer", and "free keepalive peer:
saving connection ..." messages when selecting a peer and
finalizing upstream request. For example, a connection attempt
without a cached connection but with keepalive enabled will look
like:

2022/10/30 07:18:31 [debug] 13406#100156: *1 http init upstream, client timer: 0
2022/10/30 07:18:31 [debug] 13406#100156: *1 kevent set event: 11: ft:-2 fl:0025
2022/10/30 07:18:31 [debug] 13406#100156: *1 http script copy: "Host"
2022/10/30 07:18:31 [debug] 13406#100156: *1 http script var: "u"
2022/10/30 07:18:31 [debug] 13406#100156: *1 http script copy: "Connection"
2022/10/30 07:18:31 [debug] 13406#100156: *1 http script copy: "close"
2022/10/30 07:18:31 [debug] 13406#100156: *1 http script copy: ""
2022/10/30 07:18:31 [debug] 13406#100156: *1 http script copy: ""
2022/10/30 07:18:31 [debug] 13406#100156: *1 http proxy header:
"GET / HTTP/1.0
Host: u
Connection: close

"
2022/10/30 07:18:31 [debug] 13406#100156: *1 http cleanup add: 21982D88
2022/10/30 07:18:31 [debug] 13406#100156: *1 init keepalive peer
2022/10/30 07:18:31 [debug] 13406#100156: *1 get keepalive peer
2022/10/30 07:18:31 [debug] 13406#100156: *1 get rr peer, try: 1
2022/10/30 07:18:31 [debug] 13406#100156: *1 stream socket 12
2022/10/30 07:18:31 [debug] 13406#100156: *1 connect to 127.0.0.1:8081, fd:12 #2
2022/10/30 07:18:31 [debug] 13406#100156: *1 kevent set event: 12: ft:-1 fl:0025
2022/10/30 07:18:31 [debug] 13406#100156: *1 connected

Without keepalive enabled there will be no "init keepalive peer"
and "get keepalive peer" messages:

2022/10/30 07:21:36 [debug] 13416#100132: *1 http init upstream, client timer: 0
2022/10/30 07:21:36 [debug] 13416#100132: *1 kevent set event: 11: ft:-2 fl:0025
2022/10/30 07:21:36 [debug] 13416#100132: *1 http script copy: "Host"
2022/10/30 07:21:36 [debug] 13416#100132: *1 http script var: "u"
2022/10/30 07:21:36 [debug] 13416#100132: *1 http script copy: "Connection"
2022/10/30 07:21:36 [debug] 13416#100132: *1 http script copy: "close"
2022/10/30 07:21:36 [debug] 13416#100132: *1 http script copy: ""
2022/10/30 07:21:36 [debug] 13416#100132: *1 http script copy: ""
2022/10/30 07:21:36 [debug] 13416#100132: *1 http proxy header:
"GET / HTTP/1.0
Host: u
Connection: close

"
2022/10/30 07:21:36 [debug] 13416#100132: *1 http cleanup add: 21982D88
2022/10/30 07:21:36 [debug] 13416#100132: *1 get rr peer, try: 1
2022/10/30 07:21:36 [debug] 13416#100132: *1 stream socket 12
2022/10/30 07:21:36 [debug] 13416#100132: *1 connect to 127.0.0.1:8081, fd:12 #2
2022/10/30 07:21:36 [debug] 13416#100132: *1 kevent set event: 12: ft:-1 fl:0025
2022/10/30 07:21:36 [debug] 13416#100132: *1 connected

Hope this helps.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list -- nginx@nginx.org
To unsubscribe send an email to nginx-leave@nginx.org
Subject Author Posted

Disabling keepalive

libresco_27 October 21, 2022 11:02AM

Re: Disabling keepalive

Maxim Dounin October 21, 2022 11:18AM

Re: Disabling keepalive

libresco_27 October 28, 2022 09:01AM

Re: Disabling keepalive

Maxim Dounin October 30, 2022 12:26AM

Re: Disabling keepalive

libresco_27 November 16, 2022 09:00AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 280
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready