1

I use Unix domain datagram socket for unidirectional daemon communication. Process writing to the socket may get blocked on write(), at some peaks of computation, because reading process takes more time to compute single datagram. As writing process produces the data periodically, the cleanest way for solving the problem would be just to increase the buffering capabilities of the socket. Socket is created based on the following systemd unit file:

[Unit]
Description= Some Internal Socket

[Socket]
ListenDatagram=/run/foo/foo.sk
#ReceiveBuffer=10M
#SendBuffer=10M
#PipeSize=10M
#MessageQueueMaxMessages=1024
#MessageQueueMessageSize=1024

I have looked over man of systemd.socket and found some options that looked promising (the commented out ones). I have experimented with various combinations of these but unfortunately neither worked. After altering the unit file on disc I always rebooted the system (OS) to check if applied changes work. Every time I was able to write approximately the same number of datagrams before block. Approximately because the datagram length may vary with few bytes, so for example sometimes I was able to write 508 datagrams and the other time 483.

Does anyone know what is the correct way?

1
  • How did you prove to yourself that when you altered the unit file on disc you had actually changed an aspect of the socket in memory? This needs to be in the question. – JdeBP Sep 12 '18 at 9:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.