Why socket for communication between master and worker used the so large memory?

my nginx is just a http tunul proxy http connection, and max connection
is
just lower than 100.

ps aux

root 19849 0.0 0.0 18028 2452 ? Ss 2012 0:00 nginx:
master process /usr/local/qqwebsrv/nginx/sbin/nginx
nobody 25389 0.1 0.0 19752 4104 ? S Mar25 9:07 nginx:
worker process
nobody 25390 0.1 0.0 19752 4104 ? S Mar25 9:03 nginx:
worker process
nobody 25391 0.1 0.0 19752 4108 ? S Mar25 8:46 nginx:
worker process
nobody 25392 0.1 0.0 19760 4116 ? S Mar25 8:58 nginx:
worker process

lsof | grep nginx | grep socket

nginx 19849 root 3w unix 0xffff8102b7574380
1677964948 socket
nginx 19849 root 4u unix 0xffff81047e144f00
1677964949 socket
nginx 19849 root 6u unix 0xffff8102dce9dcc0
1677964950 socket
nginx 19849 root 7u unix 0xffff81047e532340
1677964951 socket
nginx 19849 root 8u unix 0xffff81027785a980
1677964954 socket
nginx 19849 root 9u unix 0xffff81047bd8ac80
1677964955 socket
nginx 19849 root 10u unix 0xffff8102b7574900
1677964957 socket
nginx 19849 root 12w unix 0xffff81010e285100
1677964958 socket
nginx 25389 nobody 3u unix 0xffff8102dce9dcc0
1677964950 socket
nginx 25389 nobody 4u unix 0xffff81047e144f00
1677964949 socket
nginx 25389 nobody 7u unix 0xffff81027785a980
1677964954 socket
nginx 25389 nobody 8u unix 0xffff8102b7574900
1677964957 socket
nginx 25390 nobody 3u unix 0xffff8102b7574380
1677964948 socket
nginx 25390 nobody 4u unix 0xffff81027785a980
1677964954 socket
nginx 25390 nobody 6u unix 0xffff8102b7574900
1677964957 socket
nginx 25390 nobody 7u unix 0xffff81047e532340
1677964951 socket
nginx 25391 nobody 3u unix 0xffff8102b7574380
1677964948 socket
nginx 25391 nobody 4u unix 0xffff8102b7574900
1677964957 socket
nginx 25391 nobody 6u unix 0xffff8102dce9dcc0
1677964950 socket
nginx 25391 nobody 9u unix 0xffff81047bd8ac80
1677964955 socket
nginx 25392 nobody 3u unix 0xffff8102b7574380
1677964948 socket
nginx 25392 nobody 6u unix 0xffff8102dce9dcc0
1677964950 socket
nginx 25392 nobody 8u unix 0xffff81027785a980
1677964954 socket
nginx 25392 nobody 12u unix 0xffff81010e285100
1677964958 socket

lsof |awk '$1==“nginx” && $NF == “socket” {n[$6]=$7} END {for (i in n)

{m
+= n[i]} print m / (1024 * 1024 * 1024)}’
12.5018

netstat -na | grep ESTABLISHED | wc -l

87

Hello!

On Fri, Mar 29, 2013 at 06:04:54PM +0800, MCoder wrote:

nobody 25391 0.1 0.0 19752 4108 ? S Mar25 8:46 nginx:
worker process
nobody 25392 0.1 0.0 19760 4116 ? S Mar25 8:58 nginx:
worker process

lsof | grep nginx | grep socket

nginx 19849 root 3w unix 0xffff8102b7574380
1677964948 socket

[…]

+= n[i]} print m / (1024 * 1024 * 1024)}’
12.5018

What makes you think that what you are counting is memory? From
here it looks like NODE column, with SIZE/OFF colum omitted for
some reason (likely just empty). On a linux system here the
output looks like:

$ lsof | egrep ‘socket|SIZE’
COMMAND PID USER FD TYPE DEVICE SIZE/OFF
NODE NAME
nginx 30299 mdounin 3u unix 0xffff880224f836c0 0t0
1953927 socket
nginx 30299 mdounin 6u unix 0xffff880413ff0380 0t0
1953928 socket
nginx 30300 mdounin 6u unix 0xffff880413ff0380 0t0
1953928 socket


Maxim D.
http://nginx.org/en/donation.html

it’s description in man lsof

SIZE, SIZE/OFF, or OFFSET
… In other cases, files don’t have true sizes - e.g., sockets,
FIFOs, pipes - so lsof displays for their sizes the content amounts it
finds in their kernel buffer descriptors (e.g., socket buffer size
counts
or TCP/IP window sizes.) …

2013/3/29 Maxim D. [email protected]

Hello!

On Fri, Mar 29, 2013 at 07:14:49PM +0800, MCoder wrote:

it’s description in man lsof

SIZE, SIZE/OFF, or OFFSET
… In other cases, files don’t have true sizes - e.g., sockets,
FIFOs, pipes - so lsof displays for their sizes the content amounts it
finds in their kernel buffer descriptors (e.g., socket buffer size counts
or TCP/IP window sizes.) …

And what makes you think that:

a) Numbers given in SIZE/OFF column on your system for a
particular type of object is memory used? Note that e.g. window
size is not a memory, as well as socket buffer size.

b) The particular column you are counting is SIZE/OFF?

just lower than 100.
nobody 25392 0.1 0.0 19760 4116 ? S Mar25 8:58 nginx:
nginx 25392 nobody 6u unix 0xffff8102dce9dcc0

nginx 30299 mdounin 6u unix 0xffff880413ff0380 0t0
[email protected]
nginx Info Page


nginx mailing list
[email protected]
nginx Info Page


Maxim D.
http://nginx.org/en/donation.html