Welcome! Log In Create A New Profile

Advanced

Re: [PATCH 12 of 14] Proxy: add HTTP/2 support

Piotr Sikora via nginx-devel
July 31, 2017 06:06PM
Hey Maxim,

On Tue, Jul 25, 2017 at 6:28 PM, Piotr Sikora <piotrsikora@google.com> wrote:
> Hey Maxim,
>
>> There are serious concerns about this and with other patches.
>> Most generic ones are outlined below.
>>
>> 1. Server-side HTTP/2 code complexity concerns.
>>
>> As per discussion with Valentin, introducing client-related code
>> paths in the server HTTP/2 code seems to complicate things. Given
>> that the complexity of the code is already high, it might be
>> better idea to implement separate client-side processing instead.
>
> I strongly disagree. Changes introduced to ngx_http_v2.c and
> ngx_http_v2_filter_module.c are minimal.
>
> Also, having separate client-side and server-side code would result in
> thousands of lines of duplicated code, for no reason, really.
>
>> 2. Different protocols in proxy module.
>>
>> You've introduced a completely different protocol in the proxy
>> module, which contradicts the established practice of using
>> separate modules for different protocols.
>>
>> Reasons for having all (or at least may of) the protocols
>> available in the proxy module instead are well understood, and
>> there is a long-term plan to revise current practice. The plan is
>> to preserve protocol-specific modules as a separate entities, but
>> let them share the common configuration directives, similar to how
>> it is currently done with upstream{} blocks and the overall
>> upstream infrastructure. So one can write something like
>>
>> proxy_pass fastcgi://127.0.0.1:9000;
>>
>> and get an expected result.
>>
>> While benefits of having all protocols sharing the same
>> user-visible interface are understood, approach taken with HTTP/2
>> implementation is considered suboptimal, and will likely lead to
>> something hard to maintain.
>>
>> I see two possible solutions here:
>>
>> - make HTTP/2-to-upstreams a separate full-featured upstream-based
>> module, similar to proxy or fastcgi;
>
> But that's basically:
>
> cat ngx_http_proxy_module.c \
> | sed 's/ngx_http_proxy/ngx_http_proxy_v2/g' \
> > ngx_http_proxy_v2_module.c
>
> I don't see how copying ~4500 lines of code is a good idea.
>
> Also, as mentioned elsewhere, one of the reasons for adding HTTP/2
> code to the proxy module was the ability to negotiate HTTP/1.1 or
> HTTP/2 via ALPN. Creating a separate HTTP/2-to-upstreams module won't
> allow to add such feature in the future.
>
>> - start working on the different protocols in the proxy module,
>> and introduce HTTP/2 proxying after this work is done.
>
> How is that even an option here? It's going to take forever before
> such rewrite is done, and I have no desire nor time to work on that.
>
>> Additionally, there are also some minor / related comments:
>>
>> - Parts of the code, tightly coupled with upstream infrastructure,
>> notably ngx_http_v2_upstream_output_filter(), are placed into
>> v2/ directory. Instead, they seem to belong to the
>> HTTP/2-to-upstream module implementation, as suggested in (1).
>
> Sure, this and a few other functions could be added to different files.
>
>> - Upstream infrastructure as available in
>> src/http/ngx_http_upstream.c is expected to be
>> protocol-agnostic. Introducing calls like
>> ngx_http_v2_init_connection() there is a layering violation.
>> Instead, there should be something more generic.
>
> I agree that ngx_http_v2_init_connection() isn't perfect, however,
> fake connections are an abstraction layer that needs to be added
> somewhere. The same is done for SSL, and it's somehow acceptable.
>
> I'm happy to use whatever generic mechanism is available, but there is
> none at the moment, and I don't see how adding even more code and
> complexity to this already big patchset is going to get us anywhere.
>
>> - Doing protocol parsing elsewhere instead of parsing things based
>> on what nginx got from the connection results in some generic
>> upstream mechanisms rendered not working - notably, it is no
>> longer possible to simply write headers to a cache file.
>> Serialization introduced instead, at least in its current form,
>> looks more like a bandaid.
>
> Except that HTTP/2 headers as read from the wire, even if parsed in
> separate module, couldn't be simply written to a cache file, because
> of stateful HPACK encoding, so serialization would need to be done
> anyway.
>
> Anyway, it appears that your "serious concerns" are mostly about
> organization of the code, and not the code itself. What's unclear to
> me is how much of the code review this patchset actually received,
> i.e. if the existing code would be moved to a separate
> HTTP/2-to-upstreams module, would it be acceptable or do you have
> other issues with the code?

Ping.

Best regards,
Piotr Sikora
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH 01 of 14] Output chain: propagate last_buf flag to c->send_chain()

Piotr Sikora via nginx-devel 910 June 22, 2017 04:36PM

[PATCH 02 of 14] Upstream keepalive: preserve c->data

Piotr Sikora via nginx-devel 330 June 22, 2017 04:36PM

[PATCH 03 of 14] HTTP/2: add debug logging of control frames

Piotr Sikora via nginx-devel 403 June 22, 2017 04:36PM

Re: [PATCH 03 of 14] HTTP/2: add debug logging of control frames

Valentin V. Bartenev 446 July 03, 2017 10:00AM

Re: [PATCH 03 of 14] HTTP/2: add debug logging of control frames

Piotr Sikora via nginx-devel 413 July 05, 2017 06:04AM

Re: [PATCH 03 of 14] HTTP/2: add debug logging of control frames

Valentin V. Bartenev 523 July 10, 2017 11:28AM

[PATCH 04 of 14] HTTP/2: s/client/peer/

Piotr Sikora via nginx-devel 456 June 22, 2017 04:36PM

[PATCH 05 of 14] HTTP/2: introduce h2c->conf_ctx

Piotr Sikora via nginx-devel 412 June 22, 2017 04:36PM

[PATCH 06 of 14] HTTP/2: introduce stream->fake_connection

Piotr Sikora via nginx-devel 474 June 22, 2017 04:36PM

[PATCH 07 of 14] HTTP/2: introduce ngx_http_v2_handle_event()

Piotr Sikora via nginx-devel 418 June 22, 2017 04:36PM

[PATCH 08 of 14] HTTP/2: add HTTP/2 to upstreams

Piotr Sikora via nginx-devel 677 June 22, 2017 04:36PM

[PATCH 09 of 14] Proxy: add "proxy_ssl_alpn" directive

Piotr Sikora via nginx-devel 612 June 22, 2017 04:36PM

Re: [PATCH 09 of 14] Proxy: add "proxy_ssl_alpn" directive

Maxim Dounin 376 July 13, 2017 12:30PM

[PATCH 10 of 14] Proxy: always emit "Host" header first

Piotr Sikora via nginx-devel 342 June 22, 2017 04:36PM

Re: [PATCH 10 of 14] Proxy: always emit "Host" header first

Maxim Dounin 439 July 04, 2017 12:50PM

Re: [PATCH 10 of 14] Proxy: always emit "Host" header first

Piotr Sikora via nginx-devel 327 July 05, 2017 06:30AM

[PATCH 11 of 14] Proxy: split configured header names and values

Piotr Sikora via nginx-devel 416 June 22, 2017 04:36PM

Re: [PATCH 11 of 14] Proxy: split configured header names and values

Maxim Dounin 416 July 03, 2017 10:20AM

[PATCH 13 of 14] Proxy: add "proxy_pass_trailers" directive

Piotr Sikora via nginx-devel 485 June 22, 2017 04:36PM

[PATCH 12 of 14] Proxy: add HTTP/2 support

Piotr Sikora via nginx-devel 1301 June 22, 2017 04:36PM

Re: [PATCH 12 of 14] Proxy: add HTTP/2 support

Maxim Dounin 498 July 19, 2017 10:36AM

Re: [PATCH 12 of 14] Proxy: add HTTP/2 support

Piotr Sikora via nginx-devel 477 July 25, 2017 09:30PM

Re: [PATCH 12 of 14] Proxy: add HTTP/2 support

Piotr Sikora via nginx-devel 509 July 31, 2017 06:06PM

Re: [PATCH 12 of 14] Proxy: add HTTP/2 support

Maxim Dounin 587 August 08, 2017 02:06PM

[PATCH 14 of 14] Cache: add HTTP/2 support

Piotr Sikora via nginx-devel 475 June 22, 2017 04:36PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 232
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready