Re: [hybi] Is it important to know frame length at the start of frame? (was: Re: Discontinuation of mux ...)
Zhong Yu <zhong.j.yu@gmail.com> Wed, 12 February 2014 16:09 UTC
Return-Path: <zhong.j.yu@gmail.com>
X-Original-To: hybi@ietfa.amsl.com
Delivered-To: hybi@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 1BA3D1A0338 for <hybi@ietfa.amsl.com>; Wed, 12 Feb 2014 08:09:42 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2
X-Spam-Level:
X-Spam-Status: No, score=-2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, SPF_PASS=-0.001] autolearn=ham
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aGu2fmsNKBxr for <hybi@ietfa.amsl.com>; Wed, 12 Feb 2014 08:09:37 -0800 (PST)
Received: from mail-oa0-x230.google.com (mail-oa0-x230.google.com [IPv6:2607:f8b0:4003:c02::230]) by ietfa.amsl.com (Postfix) with ESMTP id 16B681A08D1 for <hybi@ietf.org>; Wed, 12 Feb 2014 08:09:37 -0800 (PST)
Received: by mail-oa0-f48.google.com with SMTP id l6so11027374oag.7 for <hybi@ietf.org>; Wed, 12 Feb 2014 08:09:36 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=ixW4tt3NS9X5NBhI0caL7mMVzpo9OFwuVXkUcuDBlsY=; b=DVKhDZcmb7wxwlNDTl6v11pOg6D1PC9Zv/ZvwWbCrke3ujSd2nO0GQqCsM0FHZ93lO MarL/Ke8711G1RdHHBIdKpMhdHxsspCkWXzE975T9KWxtDwHlo7akWVYEXDINwlJz8MY YYAUi8jbs/cI0Fy5JbSTgWyeLE39nFqF9vDDzykFZeBkRm2M6bp7RVTml4VVKdFEiLwl LQgIqdNyquwbgJqFUHQTMGcCYms4wnDxs62AKO++OBi5Yq2qgKXcZO0vBFzH85Ka7KWN I7GM77A7CjFShGclOaajLuhTiNFZ6E0yGSBupY6Df9LE5y2MSPPYYDiR5suosvwtT05g Babg==
MIME-Version: 1.0
X-Received: by 10.60.37.99 with SMTP id x3mr1744003oej.61.1392221376091; Wed, 12 Feb 2014 08:09:36 -0800 (PST)
Received: by 10.76.21.132 with HTTP; Wed, 12 Feb 2014 08:09:36 -0800 (PST)
In-Reply-To: <CAG4zZZAfB_phXSVku+W+VbGRNMJ3+=9YPw8_dD6zSJr5041iEw@mail.gmail.com>
References: <CAH9hSJbf_ABT7ECL9eS=_ADrncX8qBtxZv=uLcdu9_6GUv23Uw@mail.gmail.com> <8984EA8D-C6ED-49BF-92C4-113D69121B30@brandedcode.com> <CAG4zZZAfB_phXSVku+W+VbGRNMJ3+=9YPw8_dD6zSJr5041iEw@mail.gmail.com>
Date: Wed, 12 Feb 2014 10:09:36 -0600
Message-ID: <CACuKZqF+XZs0y04Svxb=rKhFEydwxp=8pwTiaL+3sm6cXF7_5Q@mail.gmail.com>
From: Zhong Yu <zhong.j.yu@gmail.com>
To: Joakim Erdfelt <joakim@intalio.com>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
Cc: "hybi@ietf.org" <hybi@ietf.org>
Subject: Re: [hybi] Is it important to know frame length at the start of frame? (was: Re: Discontinuation of mux ...)
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/hybi>, <mailto:hybi-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/hybi/>
List-Post: <mailto:hybi@ietf.org>
List-Help: <mailto:hybi-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 12 Feb 2014 16:09:42 -0000
Why does it matter if a frame (of unknown size) is composed of fragments (of known sizes), w.r.t. memory management? On Wed, Feb 12, 2014 at 7:49 AM, Joakim Erdfelt <joakim@intalio.com> wrote: > For various application level APIs that depend on delivery of complete > messages, the need to know the frame level size at the start of the frame > becomes important for memory management. Eclipse Jetty uses this > information to implement Java's javax.websocket API for limiting memory use, > along with lower level (WS+HTTP/1.1) protocol validation (close code 1009). > > Since this group has a history (now) of making protocol decisions based on > existing public APIs (re Javascript WebSocket), I would entreat the members > here to think about the other public, industry standard, non-javascript, > WebSocket APIs already widely deployed. > > > -- > Joakim Erdfelt <joakim@intalio.com> > webtide.com - intalio.com/jetty > Expert advice, services and support from from the Jetty & CometD experts > eclipse.org/jetty - cometd.org > > > On Wed, Feb 12, 2014 at 6:34 AM, Micheil Smith <micheil@brandedcode.com> > wrote: >> >> As far as I recall, this was also to enable more efficient reading and >> error checking. >> Prefixing with the frame size means you don't need to scan every byte >> being >> received in order to find an end of frame delimiter. >> >> This is a particularly useful thing when doing something like upstreaming >> on a >> websocket server, where all you care about is the very start of the >> message, >> and the length, such that you can then just read() N bytes which is the >> size of >> your frame and just write() directly. >> >> In other words, I agree on your reply Takeshi. >> >> - Micheil >> >> On 7 Feb 2014, at 7:30 am, Takeshi Yoshino <tyoshino@google.com> wrote: >> >> > I remember that in early days of the standardization, somebody was >> > proposing (*) that we should have a message length field in the first >> > fragment to allow for allocating buffer for full message at the beginning. >> > >> > On Thu, Jan 16, 2014 at 3:27 PM, "Martin J. Dürst" >> > <duerst@it.aoyama.ac.jp> wrote: >> > On 2014/01/16 15:05, Yutaka Hirano wrote: >> > Hi Joakim, >> > >> > Thanks for the comment. >> > >> > Knowing the size of a frame at the start of the frame, traditional >> > websocket behavior, is desired, as it allows us to fast fail for the >> > 1009 >> > (message too big) use case. >> > >> > Do you know how effective it is? >> > >> > Having no prior knowledge of frame size is undesirable to us. >> > >> > On the other hand, the frame sender have more freedom because they don't >> > have to know the size of the frame in front. >> > >> > My understanding of why messages are split into frames was that this >> > would allow to start a message without knowing its length. But if you don't >> > know the size of a frame before sending it, then the right solution is to >> > make it smaller. Frames are just arbitrary pieces of a message. >> > >> > We should be clear if we want to make it able to >> > (a) know the length of WebSocket frame on receiving the header of each >> > fragment >> > (b) know the length of WebSocket message on receiving the first fragment >> > >> > As the proposal (*) has been rejected and not in the RFC6455 header, (b) >> > is not true even in RFC6455. What Joakim said should be to keep (a) which is >> > true now in RFC6455. >> > >> > But if a message is fragmented into smaller frames, we cannot reject >> > (and send 1009) the message on receiving the first frame. "Whether we can >> > fast-reject a big message on receiving some non-final frame" depends on how >> > the peer fragments a message. >> > >> > In some plans discussed in the main thread, it's planned to drop frame >> > length info for efficiency. But something else such as the length field of >> > HTTP/2.0 DATA frame tells how much data the fragment (when multiple DATAs >> > convey a WebSocket frame, each DATA would be called fragments of a frame) >> > contains. So, we won't be able to know the length of fragments >> > (original/encapsulated WebSocket frames) on receiving each of them, but >> > still be able to know the length of sub-fragments (e.g. HTTP/2.0 data >> > frames). >> > >> > I think this change is acceptable and shouldn't be considered as >> > breaking of RFC6455 semantics. Even in the mux extension I was editing >> > (http://tools.ietf.org/html/draft-ietf-hybi-websocket-multiplexing-11), I >> > made the same change. The length of the encapsulated frame is unknown until >> > receiving all the fragments of the encapsulating message. No one was >> > objecting to that when we were discussing the spec, IIRC. >> > >> > _______________________________________________ >> > hybi mailing list >> > hybi@ietf.org >> > https://www.ietf.org/mailman/listinfo/hybi >> >> _______________________________________________ >> hybi mailing list >> hybi@ietf.org >> https://www.ietf.org/mailman/listinfo/hybi > > > > _______________________________________________ > hybi mailing list > hybi@ietf.org > https://www.ietf.org/mailman/listinfo/hybi >
- Re: [hybi] Is it important to know frame length a… Zhong Yu
- Re: [hybi] Is it important to know frame length a… Joakim Erdfelt
- Re: [hybi] Is it important to know frame length a… Peter Thorson
- Re: [hybi] Is it important to know frame length a… Joakim Erdfelt
- Re: [hybi] Is it important to know frame length a… Takeshi Yoshino
- [hybi] Is it important to know frame length at th… Takeshi Yoshino
- Re: [hybi] Is it important to know frame length a… Micheil Smith
- Re: [hybi] Is it important to know frame length a… Joakim Erdfelt
- Re: [hybi] Is it important to know frame length a… Zhong Yu
- Re: [hybi] Is it important to know frame length a… Peter Thorson
- Re: [hybi] Is it important to know frame length a… Zhong Yu
- Re: [hybi] Is it important to know frame length a… Zhong Yu
- Re: [hybi] Is it important to know frame length a… Tobias Oberstein
- Re: [hybi] Is it important to know frame length a… Zhong Yu
- Re: [hybi] Is it important to know frame length a… Takeshi Yoshino
- Re: [hybi] Is it important to know frame length a… Takeshi Yoshino
- Re: [hybi] Is it important to know frame length a… Joakim Erdfelt
- Re: [hybi] Is it important to know frame length a… Joakim Erdfelt
- Re: [hybi] Is it important to know frame length a… Takeshi Yoshino
- Re: [hybi] Is it important to know frame length a… Takeshi Yoshino
- Re: [hybi] Is it important to know frame length a… Joakim Erdfelt
- Re: [hybi] Is it important to know frame length a… Roberto Peon
- Re: [hybi] Is it important to know frame length a… Zhong Yu
- Re: [hybi] Is it important to know frame length a… Zhong Yu
- Re: [hybi] Is it important to know frame length a… Roberto Peon
- Re: [hybi] Is it important to know frame length a… Zhong Yu
- Re: [hybi] Is it important to know frame length a… Takeshi Yoshino
- Re: [hybi] Is it important to know frame length a… Takeshi Yoshino