posix_mq RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: "Iñaki Baz Castillo" <ibc@aliax.net>
To: ruby.posix.mq@librelist.org
Subject: Re: [RFC] try* interfaces in posix_mq 0.8.0pre
Date: Sun, 27 Feb 2011 15:44:07 +0100	[thread overview]
Message-ID: <AANLkTikhgvFS+XdL=OBAB+L=VW63voF57Cc8gFf95jwq@mail.gmail.com> (raw)
In-Reply-To: 20110227112612.GA23802@dcvr.yhbt.net

2011/2/27 Eric Wong <normalperson@yhbt.net>:
> I just pushed this out to RubyGems.org (and ruby_posix_mq.git).
> Let us know what you think, thanks!
>
>  posix_mq 0.8.0pre - kinder, gentler and less exceptional
>
>  This adds trysend, tryreceive, and tryshift interfaces to avoid
>  exceptions on common EAGAIN errors for non-blocking users.  EAGAIN
>  during non-blocking messages is common when there are multiple
>  readers/writer threads/processes working on the same queue.
>
>  trysend is like send, except it returns true for success and false for
>  EAGAIN.  send (still) returns nil, which I now consider a mistake but
>  won't change until post-1.0...
>
>  tryreceive and tryshift are like receive and shift respectively,
>  but they return nil for EAGAIN and the same return values
>  for their non-shift variants.
>
>  None of these methods call mq_setattr() beforehand to set the
>  non-blocking flag, it assumes the user set it once before they were ever
>  called and never changes it.  Checking/setting the non-blocking flag
>  every time is needless overhead and still subject to race conditions if
>  multiple processes/queues keep flipping flag on the same queue
>  descriptor.
>
>  These interfaces are not yet final, feedback is appreciated
>  at ruby.posix.mq@librelist.org.

Hi Eric, nice addition. In my benchmarks raising/rescuing exception is
really expensive. When a Ruby server gets congested and starts
raising/rescuing exceptions things become even worse. So I strongly
agree with your new features (similar to Gio in Unicorn, right?) :)

I will test it ASAP and comment here.



-- 
Iñaki Baz Castillo
<ibc@aliax.net>

  reply	other threads:[~2011-02-27 14:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-27 11:26 [RFC] try* interfaces in posix_mq 0.8.0pre Eric Wong
2011-02-27 14:44 ` Iñaki Baz Castillo [this message]
2011-02-27 15:01   ` Iñaki Baz Castillo
2011-02-27 16:15     ` Iñaki Baz Castillo
     [not found]       ` <20110227222400.GB31726@dcvr.yhbt.net>
     [not found]         ` <AANLkTins0SjXeC6XBczdWakMo1e5pQSd9mo9EkjQ+E2e@mail.gmail.com>
2011-02-27 23:23           ` Iñaki Baz Castillo
2011-02-27 23:51             ` Eric Wong
2011-02-27 22:27     ` Eric Wong

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/ruby_posix_mq/

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

  git send-email \
    --in-reply-to='AANLkTikhgvFS+XdL=OBAB+L=VW63voF57Cc8gFf95jwq@mail.gmail.com' \
    --to=ibc@aliax.net \
    --cc=ruby.posix.mq@librelist.org \
    /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/ruby_posix_mq.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).