yahns Ruby server user/dev discussion
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: yahns-public@yhbt.net
Subject: [PATCH] yahns/worker: shrink pipe under Linux
Date: Thu, 13 Dec 2018 10:10:03 +0000	[thread overview]
Message-ID: <20181213101003.22863-1-e@80x24.org> (raw)

We use eventfd whereever possible, but workers still require
a pipe to the parent for death detection.
 lib/yahns/worker.rb | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/yahns/worker.rb b/lib/yahns/worker.rb
index 9192803..1b65e3d 100644
--- a/lib/yahns/worker.rb
+++ b/lib/yahns/worker.rb
@@ -9,6 +9,14 @@ class Yahns::Worker # :nodoc:
   def initialize(nr)
     @nr = nr
     @to_io, @wr = Kgio::Pipe.new
+    # Seems it's only alpha with a != 4K page size on Linux
+    begin
+      # F_SETPIPE_SZ = 1031, PAGE_SIZE = 4096
+      @to_io.fcntl(1031, 4096)
+    rescue Errno::EINVAL
+      # old kernel
+    end if RUBY_PLATFORM =~ /\blinux\b/ && RUBY_PLATFORM !~ /alpha/
   def atfork_child

                 reply	other threads:[~2018-12-13 10: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:

  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=20181213101003.22863-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=yahns-public@yhbt.net \


* 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


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).