You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jim Jagielski <ji...@jaguNET.com> on 2014/09/23 21:45:11 UTC

What's need for http/2.0?

APR:
Considering that before we know it, http/2.0 will
be here, and ignoring httpd for the time being,
what features/additions do we see as being needed
to support http/2.0 from an APR library level? How do
we compare w/ libuv, for example? How "event-aware"
should APR be, ala libevent?

HTTPD:
From the httpd point of view, what does serf
provide for us to help us get to http/2.0? Should
we make it a requirement? Are there things we
need that, instead of making them part of httpd,
should really be in APR instead? What other external
libs should we be leveraging?

Re: What's need for http/2.0?

Posted by Simo Sorce <si...@redhat.com>.
On Thu, 25 Sep 2014 05:26:38 -0700
Paul Querna <pa...@querna.org> wrote:

> On Tue, Sep 23, 2014 at 12:45 PM, Jim Jagielski <ji...@jagunet.com>
> wrote:
> > APR:
> > Considering that before we know it, http/2.0 will
> > be here, and ignoring httpd for the time being,
> > what features/additions do we see as being needed
> > to support http/2.0 from an APR library level? How do
> > we compare w/ libuv, for example? How "event-aware"
> > should APR be, ala libevent?
> 
> On APR:  I mean. It's a platform layer over OS syscalls.  it works.
> But... Having has a hand in early libuv development:
> 
> libuv is fundamentally different -- everything is event based,
> anything that isn't able to be 'natively evented' into the OS event
> loop is dispatched to a thread pool.  __This is nice because it gives
> you a constant abstraction to IO operations, not just the OS
> syscalls.__
> 
> APR lacks this POV.  This has trade offs.  Most commonly, File IO, as
> you need to do a blocking IO operation in another thread, which means
> you add a context switch or three to do IO.  However with the changes
> to framing in http2, the days of just sendfile()'ing a file and
> blocking a thread are basically over, so maybe its not a huge deal in
> the end.
> 
> As libuv was designed to be embedded in garbage collected languages,
> libuv also does not adopt pools.  From my experience pools also tend
> to be harder to keep fine grained in most evented models, but this
> doesn't mean they couldn't be layered on top with care.
> 
> My POV: I'd just use libuv, and port any APR-Util code to a library on
> top of libuv if it is needed.  I'd probably keep pools for module
> level code using requests, but I'm unsure about connection pools
> honestly.

I can give you a data point on memory management from the experience
with event driven/async programming in the Samba project.

There we use talloc, a hierarchical memory allocator, and we find it a
great match for event driven/asynchronous models as it allows automatic
cleanup of memory and other resources (like file handles) via
destructors, yet each memory context can be really fine grained and
tied well to the memory structures being used.
I find pools extremely handy, but adding a hierarchical layer on them
could make them better suited for event driven/asynchronous request
mechanisms.

my 2c,
HTH.

Simo.

-- 
Simo Sorce * Red Hat, Inc * New York

Re: What's need for http/2.0?

Posted by Paul Querna <pa...@querna.org>.
On Tue, Sep 23, 2014 at 12:45 PM, Jim Jagielski <ji...@jagunet.com> wrote:
> APR:
> Considering that before we know it, http/2.0 will
> be here, and ignoring httpd for the time being,
> what features/additions do we see as being needed
> to support http/2.0 from an APR library level? How do
> we compare w/ libuv, for example? How "event-aware"
> should APR be, ala libevent?

On APR:  I mean. It's a platform layer over OS syscalls.  it works.
But... Having has a hand in early libuv development:

libuv is fundamentally different -- everything is event based,
anything that isn't able to be 'natively evented' into the OS event
loop is dispatched to a thread pool.  __This is nice because it gives
you a constant abstraction to IO operations, not just the OS
syscalls.__

APR lacks this POV.  This has trade offs.  Most commonly, File IO, as
you need to do a blocking IO operation in another thread, which means
you add a context switch or three to do IO.  However with the changes
to framing in http2, the days of just sendfile()'ing a file and
blocking a thread are basically over, so maybe its not a huge deal in
the end.

As libuv was designed to be embedded in garbage collected languages,
libuv also does not adopt pools.  From my experience pools also tend
to be harder to keep fine grained in most evented models, but this
doesn't mean they couldn't be layered on top with care.

My POV: I'd just use libuv, and port any APR-Util code to a library on
top of libuv if it is needed.  I'd probably keep pools for module
level code using requests, but I'm unsure about connection pools
honestly.

Re: What's need for http/2.0?

Posted by Graham Leggett <mi...@sharp.fm>.
On 23 Sep 2014, at 9:45 PM, Jim Jagielski <ji...@jaguNET.com> wrote:

> APR:
> Considering that before we know it, http/2.0 will
> be here, and ignoring httpd for the time being,
> what features/additions do we see as being needed
> to support http/2.0 from an APR library level? How do
> we compare w/ libuv, for example? How "event-aware"
> should APR be, ala libevent?
> 
> HTTPD:
> From the httpd point of view, what does serf
> provide for us to help us get to http/2.0? Should
> we make it a requirement? Are there things we
> need that, instead of making them part of httpd,
> should really be in APR instead? What other external
> libs should we be leveraging?

What I’ve been doing is attempting to solve the various issues around the filter stack and async support, the idea being that if the filter stack (and common modules like mod_ssl) can do async, then http/2.0 can follow easily.

From analysing the code it seems the attempt to do async support started last time at the first handler, when really it needs to start at the last filter (the network filter) and work backwards.

I intend to commit the async connection filter stack patch posted earlier in the next few days based on the work so far.

Thinking ahead to the request filter stack (the next bit going backwards, as opposed to the connection filter stack), the problem we have is the connection filter stack gets called with empty brigades and has the opportunity to clear data, but the request filter stack does not. What I had in mind was a special connection filter at the bottom of the stack whose job it is to “wake up” request filters that it is aware of when the connection filters are woken up. The trick is to keep track of the requests in flight, and removing them when EOR comes past. I think it is quite possible to make out filter stack 100% async pretty easily once this is done.

My shopping list from the MPMS:

- I want to be able to block for read / block for write on connections created by the MPM (can do)
- I want to be able to control the direction of read/write so when SSL reverses the sense it can do so (can do)
- I want to be able to mask a connection - ie put events to sleep for a period of time (can’t do, want it for rate control).
- I want to be able to add connections of my own (ie for mod_proxy, maybe we can do this?)

Regards,
Graham
—


Re: What's need for http/2.0?

Posted by Paul Querna <pa...@querna.org>.
On Tue, Sep 23, 2014 at 12:45 PM, Jim Jagielski <ji...@jagunet.com> wrote:
> APR:
> Considering that before we know it, http/2.0 will
> be here, and ignoring httpd for the time being,
> what features/additions do we see as being needed
> to support http/2.0 from an APR library level? How do
> we compare w/ libuv, for example? How "event-aware"
> should APR be, ala libevent?

On APR:  I mean. It's a platform layer over OS syscalls.  it works.
But... Having has a hand in early libuv development:

libuv is fundamentally different -- everything is event based,
anything that isn't able to be 'natively evented' into the OS event
loop is dispatched to a thread pool.  __This is nice because it gives
you a constant abstraction to IO operations, not just the OS
syscalls.__

APR lacks this POV.  This has trade offs.  Most commonly, File IO, as
you need to do a blocking IO operation in another thread, which means
you add a context switch or three to do IO.  However with the changes
to framing in http2, the days of just sendfile()'ing a file and
blocking a thread are basically over, so maybe its not a huge deal in
the end.

As libuv was designed to be embedded in garbage collected languages,
libuv also does not adopt pools.  From my experience pools also tend
to be harder to keep fine grained in most evented models, but this
doesn't mean they couldn't be layered on top with care.

My POV: I'd just use libuv, and port any APR-Util code to a library on
top of libuv if it is needed.  I'd probably keep pools for module
level code using requests, but I'm unsure about connection pools
honestly.

Re: What's need for http/2.0?

Posted by Graham Leggett <mi...@sharp.fm>.
On 25 Sep 2014, at 2:13 PM, Paul Querna <pa...@querna.org> wrote:

> http/2.0 in the simplest implementation is just another protocol to
> httpd.  We have the constructs to handle it, kinda.  Improvements to
> async support in various bits will help.
> 
> However our constructs about requests and connections (and their
> pools) are still grounded in the http1 mindset. http2 should challenge
> us to do real multiplexing of requests.  I don't believe our existing
> hierarchy of pools deals well with the complexities of lifetime
> management of data in this multiplexed world, especially when you
> multiply that multiplexed nature of an http2 proxy (or reverse proxy)
> with its own outbound connections and requests.

A while back I built two async-only applications backed with APR’s pools that handled a similar problem as to the one described above, and the APR pools were not only highly suited to task but were also key in making sure it all worked properly.

In the first case we used libev, and in the second case we used libevent.

Ideally I want to be able to use APR without having to prop it up with an external event library. If we can enrich the apr_poll library to the point where it gives us the full range of event functionality that will be ideal.

> Additionally there are 'new' things that we don't deal with today, like:
> 
> * Server Push
> * Stream Prioritization
> * Flow Control integration into proxy use cases
> 
> Things like flow control and stream priorities interact poorly with
> the output current filter API and model -- calling the next function
> with a brigade, even if it wants you to try again, every caller has to
> deal with these complexities of back pressure -- I'd love to have more
> open discussion about ideas here.

Dealing with back pressure is the reality - the idea that you can blindly pass an arbitrarily large body of work to a downstream filter and not give that downstream filter the option to say “woah there, slow down” is where we suffered. I believe the API I proposed handles this, so far it works pretty well.

> http2 will be around for another 20+ years, I'd challenge us to think
> about it as the default case, and http1 as a fallback case that we
> still support well, but the architecture and APIs are optimized for
> the future case.

I think it all begins with apr_poll (or it’s successor).

Regards,
Graham
—


Re: What's need for http/2.0?

Posted by Paul Querna <pa...@querna.org>.
httpd side:

serf to me is the wrong question.

http/2.0 in the simplest implementation is just another protocol to
httpd.  We have the constructs to handle it, kinda.  Improvements to
async support in various bits will help.

However our constructs about requests and connections (and their
pools) are still grounded in the http1 mindset. http2 should challenge
us to do real multiplexing of requests.  I don't believe our existing
hierarchy of pools deals well with the complexities of lifetime
management of data in this multiplexed world, especially when you
multiply that multiplexed nature of an http2 proxy (or reverse proxy)
with its own outbound connections and requests.

Additionally there are 'new' things that we don't deal with today, like:

* Server Push
* Stream Prioritization
* Flow Control integration into proxy use cases

Things like flow control and stream priorities interact poorly with
the output current filter API and model -- calling the next function
with a brigade, even if it wants you to try again, every caller has to
deal with these complexities of back pressure -- I'd love to have more
open discussion about ideas here.

http2 will be around for another 20+ years, I'd challenge us to think
about it as the default case, and http1 as a fallback case that we
still support well, but the architecture and APIs are optimized for
the future case.


On Tue, Sep 23, 2014 at 12:45 PM, Jim Jagielski <ji...@jagunet.com> wrote:
> APR:
> Considering that before we know it, http/2.0 will
> be here, and ignoring httpd for the time being,
> what features/additions do we see as being needed
> to support http/2.0 from an APR library level? How do
> we compare w/ libuv, for example? How "event-aware"
> should APR be, ala libevent?
>
> HTTPD:
> From the httpd point of view, what does serf
> provide for us to help us get to http/2.0? Should
> we make it a requirement? Are there things we
> need that, instead of making them part of httpd,
> should really be in APR instead? What other external
> libs should we be leveraging?

Re: What's need for http/2.0?

Posted by Graham Leggett <mi...@sharp.fm>.
On 23 Sep 2014, at 9:45 PM, Jim Jagielski <ji...@jaguNET.com> wrote:

> APR:
> Considering that before we know it, http/2.0 will
> be here, and ignoring httpd for the time being,
> what features/additions do we see as being needed
> to support http/2.0 from an APR library level? How do
> we compare w/ libuv, for example? How "event-aware"
> should APR be, ala libevent?
> 
> HTTPD:
> From the httpd point of view, what does serf
> provide for us to help us get to http/2.0? Should
> we make it a requirement? Are there things we
> need that, instead of making them part of httpd,
> should really be in APR instead? What other external
> libs should we be leveraging?

What I’ve been doing is attempting to solve the various issues around the filter stack and async support, the idea being that if the filter stack (and common modules like mod_ssl) can do async, then http/2.0 can follow easily.

From analysing the code it seems the attempt to do async support started last time at the first handler, when really it needs to start at the last filter (the network filter) and work backwards.

I intend to commit the async connection filter stack patch posted earlier in the next few days based on the work so far.

Thinking ahead to the request filter stack (the next bit going backwards, as opposed to the connection filter stack), the problem we have is the connection filter stack gets called with empty brigades and has the opportunity to clear data, but the request filter stack does not. What I had in mind was a special connection filter at the bottom of the stack whose job it is to “wake up” request filters that it is aware of when the connection filters are woken up. The trick is to keep track of the requests in flight, and removing them when EOR comes past. I think it is quite possible to make out filter stack 100% async pretty easily once this is done.

My shopping list from the MPMS:

- I want to be able to block for read / block for write on connections created by the MPM (can do)
- I want to be able to control the direction of read/write so when SSL reverses the sense it can do so (can do)
- I want to be able to mask a connection - ie put events to sleep for a period of time (can’t do, want it for rate control).
- I want to be able to add connections of my own (ie for mod_proxy, maybe we can do this?)

Regards,
Graham
—


Re: What's need for http/2.0?

Posted by Yann Ylavic <yl...@gmail.com>.
On Wed, Sep 24, 2014 at 11:10 PM, Yann Ylavic <yl...@gmail.com> wrote:
> On Tue, Sep 23, 2014 at 9:45 PM, Jim Jagielski <ji...@jagunet.com> wrote:
>> HTTPD:
>> From the httpd point of view, what does serf
>> provide for us to help us get to http/2.0?
>
> How about a new mod_proxy_http2 which can go async like in
> mod_proxy_wstunnel (trunk)?
> Some code could then be moved to input/output filters.

Hm, that's only a proxy point of view...

Re: What's need for http/2.0?

Posted by Yann Ylavic <yl...@gmail.com>.
On Wed, Sep 24, 2014 at 11:10 PM, Yann Ylavic <yl...@gmail.com> wrote:
> On Tue, Sep 23, 2014 at 9:45 PM, Jim Jagielski <ji...@jagunet.com> wrote:
>> HTTPD:
>> From the httpd point of view, what does serf
>> provide for us to help us get to http/2.0?
>
> How about a new mod_proxy_http2 which can go async like in
> mod_proxy_wstunnel (trunk)?
> Some code could then be moved to input/output filters.

Hm, that's only a proxy point of view...

Re: What's need for http/2.0?

Posted by Yann Ylavic <yl...@gmail.com>.
On Tue, Sep 23, 2014 at 9:45 PM, Jim Jagielski <ji...@jagunet.com> wrote:
> HTTPD:
> From the httpd point of view, what does serf
> provide for us to help us get to http/2.0?

How about a new mod_proxy_http2 which can go async like in
mod_proxy_wstunnel (trunk)?
Some code could then be moved to input/output filters.

Re: What's need for http/2.0?

Posted by Yann Ylavic <yl...@gmail.com>.
On Tue, Sep 23, 2014 at 9:45 PM, Jim Jagielski <ji...@jagunet.com> wrote:
> HTTPD:
> From the httpd point of view, what does serf
> provide for us to help us get to http/2.0?

How about a new mod_proxy_http2 which can go async like in
mod_proxy_wstunnel (trunk)?
Some code could then be moved to input/output filters.