W3C home > Mailing lists > Public > ietf-http-wg@w3.org > July to September 2012

Re: SPDY Header Frames

From: Roberto Peon <grmocg@gmail.com>
Date: Tue, 17 Jul 2012 01:00:16 -0700
Message-ID: <CAP+FsNchmj8iLCsbPrk+Af3XVog69ZoKvP3eBVq2NtQ+ptygRw@mail.gmail.com>
To: Poul-Henning Kamp <phk@phk.freebsd.dk>
Cc: HTTP Working Group <ietf-http-wg@w3.org>, James M Snell <jasnell@gmail.com>
The max theoretical compression with a perfect deflate implementation is
1024 to one, according to documentation.
Thankfully, the zlib reference implementation allows stream decompression
and thus allows you to specify the max amount of bytes one allows the
incoming stream to inflate into. In other words, memory usage is bounded
and you can reject stuff that is overly large before it causes any problems.

I'm not particularly enamored of the deflate stuff as a whole solution. I
think it is just part of a whole solution in a solution space than needs
more exploration.
I'll be putting something out about this shortly, actually... just have to
stop responding here so I have time to finish writing it up (and then get
to work simulating and experimenting)!

-=R
On Jul 17, 2012 12:28 AM, "Poul-Henning Kamp" <phk@phk.freebsd.dk> wrote:

> In message <CABP7RbdZPYYqtDFWUprrAmGQ8GehOTh-LvXq9gizXGUJg4=
> 68g@mail.gmail.com>
> , James M Snell writes:
>
> >3. Values may be binary or character based, as indicated by a flags field.
> >Values may be up to max(int32) in length.
>
> Allowing such large fields is counterproductive in my opinion.
>
> No implementation can have a limit that large without becoming
> a sitting duck for DoS attacks.
>
> It would be far better to put a realistic, but still generous size
> restriction.  Not sure if 16 bits is always enough, but the advantage
> will likely outweigh any disadvantages.
>
> >The entire header block is encoded into a structure of 145 bytes in
> length;
> >
> [...]
> >
> >By comparison, the same structure encoded using the existing SPDY HEADER
> >block would require 208 bytes sans compression.
> >
> >After applying compression of the block using the SPDY dictionary, the
> >block compresses into 6 compact bytes.
> >
> >[120, 63, -29, -58, -89, -62]
>
> This is where I think we should be careful about what we measure
> and optimize for.
>
> Those six bytes will take a lot more CPU effort to unpack than
> your 145 bytes (I think your proposed encoding is quite bloated
> btw, but that's not an argument I need to carry for this point).
>
> The really important metric is that most requests fit in a single
> MTU.  Inside that limit, expending bytes to gain parsing speed can
> be both a good and necessary (for HTTP-routers) tradeoff.
>
> In that view, the difference between six and 208 bytes is not
> terribly significant on its own, whereas a difference between
> 1400 and 1602 bytes would be.
>
> The main and almost only reason requests don't fit in one MTU is
> cookies, with a minor side-order of URI and User-Agent,
> so if we can design away the need for cookies, we (almost)
> don't need the computational complexity of deflate.
>
> And there is another aspect which has me very worried about
> deflate at this point in the protocol:  Has anybody tried
> to see how big a deflate output they can produce with
> a single MTU of input ?
>
> My guestimate is well north of a 1MB.
>
> That's a lot of DoS leverage for a single packet.
>
> --
> Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
> phk@FreeBSD.ORG         | TCP/IP since RFC 956
> FreeBSD committer       | BSD since 4.3-tahoe
> Never attribute to malice what can adequately be explained by incompetence.
>
>
Received on Tuesday, 17 July 2012 08:00:56 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 17 July 2012 08:01:06 GMT