[Libwebsockets] Does lws implement http2 priority

Andy Green andy at warmcat.com
Tue Dec 18 03:03:17 CET 2018

On December 18, 2018 8:12:17 AM GMT+08:00, "ygu18 at illinois.edu" <jimgyc95 at gmail.com> wrote:
>Hi guys,
>I was trying to do http2 multiplexing with LWS. It looks like there is
>API related to setting stream priorities.
>I went through the source and found some parameters that looks
>struct lws->struct _lws_h2_related->my_priority and dependent_on.
>there doesn’t seem to be any utilization of said parameters.
>Is LWS not implementing priority or am I missing sth here? Didn’t see
>notes or TODO items either.

Until now neither I nor anyone else has wanted or told they wanted PRIORITY.  For h2 it's literally just me working on it.

As it stands all streams that want to send something are round-robin'ed choosing their own frame size while the network connection writability and tx credit hold out.  Since PRIORITY is the expression of a wish rather than a requirement, in most cases ignoring it is fine, or is just causing some inefficiency in ordering at the client rather than death.

Implementing PRIORITY means not only changing the round-robin to follow its schedule but also to modulate user code frame sizes to meet the PRIORITY hierarchy... since h2 or not tries to be transparent for the lws user api, most users are going to ignore anything about that on their side (there's already an api to get guidence about how much is writable from tx credit, but it's not used by anything).  It means there'll be an increase in stuff buffered at the server because it's truncated deliberately to provide the PRIORITY shaping.  It's not a huge problem but it's not zero cost either.  If high priority content is unavailable but you have low priority content, you will send the low priority stuff anyway... PRIORITY is therefore of somewhat doubtful utility.

In short the world still turns fine ignoring PRIORITY... patches are very welcome if you care about it... the main changes will be here


...for the round-robin and a bunch of new stuff capturing and modeling the PRIORITY hierarchy per-connection, so that it spits out who should be able to write how much next if two streams contend.



More information about the Libwebsockets mailing list