yahns Ruby server user/dev discussion
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: yahns-public@yhbt.net
Subject: beware of lowering TCP buffer sizes under Linux
Date: Thu, 21 May 2015 00:10:43 +0000	[thread overview]
Message-ID: <20150521001043.GA25809@dcvr.yhbt.net> (raw)

On Linux, the (currently) excessively large memory buffers size
defaults hide some bugs in the TCP implementation regarding
edge-triggered epoll wakeups.

Setting low :sndbuf values (or lowering tcp_wmem/tcp_mem) can cause
problems) for servers using edge-triggered I/O.  yahns uses one-shot
epoll (a special case of edge-triggering), so is also affected;
nginx uses edge-triggering, so it would also be affected.

Most other epoll users I know about use level-triggering, so are not
affected.

For now, leaving buffers at defaults should be sufficient and I've
yet to encounter this problem in the wild with default settings on
current kernels.

These problems are being worked on in netdev@vger.kernel.org:

http://mid.gmane.org/20150520155253.86202203D@prod-mail-relay06.akamai.com
http://mid.gmane.org/20150506155223.9743A2027@prod-mail-relay06.akamai.com
http://mid.gmane.org/1431718770-3815-1-git-send-email-edumazet@google.com

Fwiw, I have encountered and helped fix missing wakeup bugs in Linux
before, and I'm sure there'll be new bugs found in the future when
handling millions of sockets.

                 reply	other threads:[~2015-05-21  0:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/yahns/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150521001043.GA25809@dcvr.yhbt.net \
    --to=e@80x24.org \
    --cc=yahns-public@yhbt.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/yahns.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).