------art_40005_18745557.1147115354192
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Writes can block your process whether they are large or small- it all
depends on what is happening in your kernel at that particular point in
time. However, if a socket has just selected writable, then it generally
will be able to take a write that is the size of an ethernet packet (1400
bytes or so).  (Of course the sharper readers will point out that there are
also good reasons to avoid such small writes, especially if you don't turn
off the Nagle algorithm.) But you're asking a good question. This is one of
the reasons why blocking i/o on threads can make a lot of sense if your app
has relatively light requirements. You may find this odd but I worry more
about accepts blocking than writes. An accepting socket can select readable
(meaning a new connection is available), but be empty by the time you get
around to reading it (like if there was a network error that caused a
pending connection to reset). This can be a real nasty.

If you download the eventmachine gem and install the rdocs, the API docs
will all be there, and there is sample code too.

On 5/8/06, James Edward Gray II <james / grayproductions.net> wrote:
>
> On May 8, 2006, at 12:12 PM, Francis Cianfrocca wrote:
>
> > If your performance and scalability requirements are low, then the
> > easiest thing is
> > probably to use blocking i/o with a thread per socket. If you use
> > blocking
> > i/o, you're better off multiplexing the i/o with a select loop.
>
> But then a large write could still block the entire process, since
> Ruby's threads aren't native.  Right?
>
> > If you decide to look at EventMachine, I can support you if you like.
>
> I believe this is going to be my first choice.  I haven't had time to
> play with it yet, but it looks very nice.
>
> Are there API docs available anywhere for EventMachine?
>
> James Edward Gray II
>
>

------art_40005_18745557.1147115354192--