Rainbows! Rack HTTP server user/dev discussion
 help / color / mirror / code / Atom feed
* Single Threaded Async Responses
@ 2009-10-05 22:10 James Tucker
       [not found] ` <0956CE27-14FE-42DF-BAD9-CED31B09D85D-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: James Tucker @ 2009-10-05 22:10 UTC (permalink / raw)
  To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw

Hi Eric and anyone else listening in,

I completed an async API for Thin quite some time ago well suited to  
some of the design goals you have here. If you're interested we could  
have a chat about supporting the same API designs that allow single  
threaded reactor based concurrent responses. I believe such an API  
would fit well in rainbows too.

Kind regards,

James Tucker

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Single Threaded Async Responses
       [not found] ` <0956CE27-14FE-42DF-BAD9-CED31B09D85D-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2009-10-05 22:56   ` Eric Wong
  2009-10-19 18:33   ` Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2009-10-05 22:56 UTC (permalink / raw)
  To: James Tucker; +Cc: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw

James Tucker <jftucker-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Hi Eric and anyone else listening in,
>
> I completed an async API for Thin quite some time ago well suited to  
> some of the design goals you have here. If you're interested we could  
> have a chat about supporting the same API designs that allow single  
> threaded reactor based concurrent responses. I believe such an API would 
> fit well in rainbows too.

Hi James,

This sounds interesting.

Does this mean it does synchronous request reading?  That'll mean
it requires nginx in front to work well.

So the response is written asynchronously, meaning it can be bigger than
the outgoing TCP buffers and still not block, right?  I considered
something like this for Unicorn, too, but then I realised that all the
responses I see managed to fit into the TCP buffers without blocking
already.

But for weird OSes with tiny buffers or apps dealing with large
responses it would probably make sense for Rainbows! (especially
if you plan to help me support it into the future :)

Is it merged into Thin already?  Where can/should I take a look?

One bit to be careful for is the body of the Rack response may not be a
simple Array of String objects, so that requires extra effort/cycles to
stringify into something that can be buffered for async writes.  But
then that could be a huge chunk to keep around in memory (since we
mainly need this to support larger responses).  What nginx does is
it will buffer into a temporary file and then sendfile() it over
as the socket becomes readable.

-- 
Eric Wong

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Single Threaded Async Responses
       [not found] ` <0956CE27-14FE-42DF-BAD9-CED31B09D85D-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2009-10-05 22:56   ` Eric Wong
@ 2009-10-19 18:33   ` Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2009-10-19 18:33 UTC (permalink / raw)
  To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw

James Tucker <jftucker-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Hi Eric and anyone else listening in,
>
> I completed an async API for Thin quite some time ago well suited to  
> some of the design goals you have here. If you're interested we could  
> have a chat about supporting the same API designs that allow single  
> threaded reactor based concurrent responses. I believe such an API would 
> fit well in rainbows too.

Hi James,

I've looked at Thin and added this as a TODO item for Rainbows! once
EventMachine support gets added.

For now, we also have an a (more Rack-compatible[1] but certain
Unices-only[2]) API which relies on passing file descriptors to Rev in
Rainbows! 0.3.0.

[1] - The only thing that keeps it from running correctly under
      Rack::Lint is that Rack::Lint doesn't pass body#to_path calls
      to up the stack even though it _allows_ it.

[2] - Most Unices seem to support /dev/fd/#{io.fileno}
      to lookup the contents of the file descriptor table.

-- 
Eric Wong

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-10-19 18:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-05 22:10 Single Threaded Async Responses James Tucker
     [not found] ` <0956CE27-14FE-42DF-BAD9-CED31B09D85D-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-10-05 22:56   ` Eric Wong
2009-10-19 18:33   ` Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/rainbows.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).