Tr: [usenet] How not to do UDPs

Julien ÉLIE julien at trigofacile.com
Thu Oct 25 19:30:36 UTC 2007


Do you think it is a good idea to patch nnrpd to use TCP_NODELAY?

Julien

----- Message d'origine ----- 
De : "David Canzi -- non-mailable" <dmcanzi at remulak.uwaterloo.ca>
Groupes de discussion : news.admin.net-abuse.policy
Envoyé : mercredi 24 octobre 2007 19:53
Objet : Re: [usenet] How not to do UDPs


> In article <13hup9dd816lrbf at news.supernews.com>,
> Peter Pearson  <ppearson at nowhere.invalid> wrote:
>>Another point in favor of dealing with floods at the server
>>level is that the more useful header fields for filtering
>>these floods are expensive for the user to filter on.  I
>>measure a cost on the order of 0.1 second per message, which
>>is an annoyance when there are thousands of messages.
>
> I observed this behaviour on our news server, running inn.  In some
> operating systems the default behaviour of an internet socket is
> to collect outbound data for a tenth of a second before sending,
> in the hope of sending the outbound data using fewer packets.
> This works well when a process is just sending at full blast.
> This works poorly when the conversation between a client and a
> server is more interactive.
>
> I came up with the following patch:
>
> *** nnrpd/nnrpd.c.old Tue Aug 29 05:07:29 2006
> --- nnrpd/nnrpd.c Wed Sep  6 20:52:25 2006
> ***************
> *** 14,19 ****
> --- 14,22 ----
>  #include <netdb.h>
>  #include <pwd.h>
>  #include <signal.h>
> + #include <sys/socket.h>
> + #include <netinet/in.h>
> + #include <netinet/tcp.h>
>
>  #if HAVE_GETSPNAM
>  # include <shadow.h>
> ***************
> *** 483,488 ****
> --- 486,492 ----
>      struct sockaddr_storage ssc, sss;
>      socklen_t length;
>      const char *default_host_error = "unknown error";
> +     int nodelay = 1;
>
>      ClientIpAddr = 0L;
>      ClientHost[0] = '\0';
> ***************
> *** 578,583 ****
> --- 582,588 ----
>  #endif
>  }
>      }
> +     setsockopt(STDIN_FILENO, SOL_TCP, TCP_NODELAY, &nodelay, sizeof(nodelay));
>
>      strlcpy(LogName, ClientHost, sizeof(LogName));
>
>
> -- 
> David Canzi | Eternal truths come and go. | 



More information about the inn-workers mailing list