Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the default size of datagram queue length in Unix Domain Sockets (AF_UNIX)? Is it configurable?

I know the maximum length of a datagram queue length can be found using "cat /proc/sys/net/unix/max_dgram_qlen".

I wanted to know how to find the default value that is set on boot up (like in case of the /proc/sys/net/core/wmem_default for the send buffer size).

Is it possible to increase the value of max_dgram_qlen? What is the upper limit of the same?

My kernel version is 2.6.27.7. I'm new to Unix Domain Socket programming (AF_UNIX).

Thanks in advance for any comments / solutions!

like image 938
user3184348 Avatar asked Jan 30 '14 06:01

user3184348


Video Answer


2 Answers

The previous answers/comments failed to understand that the OP was talking about maximum queue length in datagrams (max_dram_qlen) and not in bytes. The OS provides settings for both sizes.

You can set max_dgram_qlen using the following command:

sysctl net.unix.max_dgram_qlen=128

You may need to run with sudo and you may also need to put double quotes around max_dgram_qlen=128 depending on your shell.

Also, see What's the practical limit on the size of single packet transmitted over domain socket?.

like image 110
Lucio Paiva Avatar answered Sep 23 '22 13:09

Lucio Paiva


man unix(7):

The SO_SNDBUF socket option does have an effect for UNIX domain sockets, but the SO_RCVBUF option does not. For datagram sockets, the SO_SNDBUF value imposes an upper limit on the size of outgoing datagrams. This limit is calculated as the doubled (see socket(7)) option value less 32 bytes used for overhead.

like image 36
Maxim Egorushkin Avatar answered Sep 25 '22 13:09

Maxim Egorushkin