You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Ben Mahler <be...@gmail.com> on 2015/09/22 08:18:56 UTC

Review Request 38608: Introduced an http::Connection for connection re-use and pipelining.

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/38608/
-----------------------------------------------------------

Review request for mesos, Benjamin Hindman, Jie Yu, and Vinod Kone.


Bugs: MESOS-3332
    https://issues.apache.org/jira/browse/MESOS-3332


Repository: mesos


Description
-------

In order to support connection re-use and pipelining of requests on a shared connection, this introduces the notion of an http::Connection.


Diffs
-----

  3rdparty/libprocess/include/process/http.hpp fbd6cf7967173495875a8ea90ed28ade88b982a2 
  3rdparty/libprocess/src/http.cpp 9ad613a16c379b6d76a9a0f8d6160fe23a182fd4 
  3rdparty/libprocess/src/tests/http_tests.cpp d0b9399d38fa284466a012a21080b1d9007af98b 

Diff: https://reviews.apache.org/r/38608/diff/


Testing
-------

Added tests.


Thanks,

Ben Mahler


Re: Review Request 38608: Added an http::Connection for connection re-use and pipelining.

Posted by Ben Mahler <be...@gmail.com>.

> On Oct. 5, 2015, 11 p.m., Jie Yu wrote:
> > 3rdparty/libprocess/src/http.cpp, line 783
> > <https://reviews.apache.org/r/38608/diff/4/?file=1089303#file1089303line783>
> >
> >     s/`socket_`/`_socket`/?
> >     
> >     underscore suffix makes it more look like a member (Google style).

Agreed, I think we need to do a sweep though because the majority of our code still uses underscore as ' (prime): socket'


- Ben


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/38608/#review101540
-----------------------------------------------------------


On Oct. 3, 2015, 12:04 a.m., Ben Mahler wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/38608/
> -----------------------------------------------------------
> 
> (Updated Oct. 3, 2015, 12:04 a.m.)
> 
> 
> Review request for mesos, Benjamin Hindman, Jie Yu, and Vinod Kone.
> 
> 
> Bugs: MESOS-3332
>     https://issues.apache.org/jira/browse/MESOS-3332
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> In order to support connection re-use and pipelining of requests on a shared connection, this introduces the notion of an http::Connection.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/http.hpp ba3f0bc7df33795e332c374fbad04106b9d56416 
>   3rdparty/libprocess/src/http.cpp d9925333f25491f92495bf11315237f54a0a2015 
>   3rdparty/libprocess/src/tests/http_tests.cpp c380f356548cf9f5491044bccabcd9c66ad5f55a 
> 
> Diff: https://reviews.apache.org/r/38608/diff/
> 
> 
> Testing
> -------
> 
> Added tests.
> 
> 
> Thanks,
> 
> Ben Mahler
> 
>


Re: Review Request 38608: Added an http::Connection for connection re-use and pipelining.

Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/38608/#review101540
-----------------------------------------------------------


LGTM! Nice tests!


3rdparty/libprocess/src/http.cpp (line 783)
<https://reviews.apache.org/r/38608/#comment158961>

    s/`socket_`/`_socket`/?
    
    underscore suffix makes it more look like a member (Google style).



3rdparty/libprocess/src/http.cpp (line 979)
<https://reviews.apache.org/r/38608/#comment158963>

    Owned, instead of a raw pointer? Save a 'delete' in `~Data()`.



3rdparty/libprocess/src/tests/http_tests.cpp (line 721)
<https://reviews.apache.org/r/38608/#comment158972>

    Remove one extra blank line here.


- Jie Yu


On Oct. 3, 2015, 12:04 a.m., Ben Mahler wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/38608/
> -----------------------------------------------------------
> 
> (Updated Oct. 3, 2015, 12:04 a.m.)
> 
> 
> Review request for mesos, Benjamin Hindman, Jie Yu, and Vinod Kone.
> 
> 
> Bugs: MESOS-3332
>     https://issues.apache.org/jira/browse/MESOS-3332
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> In order to support connection re-use and pipelining of requests on a shared connection, this introduces the notion of an http::Connection.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/http.hpp ba3f0bc7df33795e332c374fbad04106b9d56416 
>   3rdparty/libprocess/src/http.cpp d9925333f25491f92495bf11315237f54a0a2015 
>   3rdparty/libprocess/src/tests/http_tests.cpp c380f356548cf9f5491044bccabcd9c66ad5f55a 
> 
> Diff: https://reviews.apache.org/r/38608/diff/
> 
> 
> Testing
> -------
> 
> Added tests.
> 
> 
> Thanks,
> 
> Ben Mahler
> 
>


Re: Review Request 38608: Added an http::Connection for connection re-use and pipelining.

Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/38608/#review101548
-----------------------------------------------------------

Ship it!


Ship It!

- Jie Yu


On Oct. 3, 2015, 12:04 a.m., Ben Mahler wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/38608/
> -----------------------------------------------------------
> 
> (Updated Oct. 3, 2015, 12:04 a.m.)
> 
> 
> Review request for mesos, Benjamin Hindman, Jie Yu, and Vinod Kone.
> 
> 
> Bugs: MESOS-3332
>     https://issues.apache.org/jira/browse/MESOS-3332
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> In order to support connection re-use and pipelining of requests on a shared connection, this introduces the notion of an http::Connection.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/http.hpp ba3f0bc7df33795e332c374fbad04106b9d56416 
>   3rdparty/libprocess/src/http.cpp d9925333f25491f92495bf11315237f54a0a2015 
>   3rdparty/libprocess/src/tests/http_tests.cpp c380f356548cf9f5491044bccabcd9c66ad5f55a 
> 
> Diff: https://reviews.apache.org/r/38608/diff/
> 
> 
> Testing
> -------
> 
> Added tests.
> 
> 
> Thanks,
> 
> Ben Mahler
> 
>


Re: Review Request 38608: Added an http::Connection for connection re-use and pipelining.

Posted by Ben Mahler <be...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/38608/
-----------------------------------------------------------

(Updated Oct. 3, 2015, 12:04 a.m.)


Review request for mesos, Benjamin Hindman, Jie Yu, and Vinod Kone.


Changes
-------

Fixed a compilation issue on OS X.


Bugs: MESOS-3332
    https://issues.apache.org/jira/browse/MESOS-3332


Repository: mesos


Description
-------

In order to support connection re-use and pipelining of requests on a shared connection, this introduces the notion of an http::Connection.


Diffs (updated)
-----

  3rdparty/libprocess/include/process/http.hpp ba3f0bc7df33795e332c374fbad04106b9d56416 
  3rdparty/libprocess/src/http.cpp d9925333f25491f92495bf11315237f54a0a2015 
  3rdparty/libprocess/src/tests/http_tests.cpp c380f356548cf9f5491044bccabcd9c66ad5f55a 

Diff: https://reviews.apache.org/r/38608/diff/


Testing
-------

Added tests.


Thanks,

Ben Mahler


Re: Review Request 38608: Added an http::Connection for connection re-use and pipelining.

Posted by Ben Mahler <be...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/38608/
-----------------------------------------------------------

(Updated Oct. 2, 2015, 11:49 p.m.)


Review request for mesos, Benjamin Hindman, Jie Yu, and Vinod Kone.


Changes
-------

Close the socket upon send error.


Bugs: MESOS-3332
    https://issues.apache.org/jira/browse/MESOS-3332


Repository: mesos


Description
-------

In order to support connection re-use and pipelining of requests on a shared connection, this introduces the notion of an http::Connection.


Diffs (updated)
-----

  3rdparty/libprocess/include/process/http.hpp ba3f0bc7df33795e332c374fbad04106b9d56416 
  3rdparty/libprocess/src/http.cpp d9925333f25491f92495bf11315237f54a0a2015 
  3rdparty/libprocess/src/tests/http_tests.cpp c380f356548cf9f5491044bccabcd9c66ad5f55a 

Diff: https://reviews.apache.org/r/38608/diff/


Testing
-------

Added tests.


Thanks,

Ben Mahler


Re: Review Request 38608: Added an http::Connection for connection re-use and pipelining.

Posted by Ben Mahler <be...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/38608/
-----------------------------------------------------------

(Updated Oct. 1, 2015, 12:19 a.m.)


Review request for mesos, Benjamin Hindman, Jie Yu, and Vinod Kone.


Changes
-------

Some simplifications driven by vinod's feedback.


Summary (updated)
-----------------

Added an http::Connection for connection re-use and pipelining.


Bugs: MESOS-3332
    https://issues.apache.org/jira/browse/MESOS-3332


Repository: mesos


Description
-------

In order to support connection re-use and pipelining of requests on a shared connection, this introduces the notion of an http::Connection.


Diffs (updated)
-----

  3rdparty/libprocess/include/process/http.hpp ba3f0bc7df33795e332c374fbad04106b9d56416 
  3rdparty/libprocess/src/http.cpp d9925333f25491f92495bf11315237f54a0a2015 
  3rdparty/libprocess/src/tests/http_tests.cpp c380f356548cf9f5491044bccabcd9c66ad5f55a 

Diff: https://reviews.apache.org/r/38608/diff/


Testing
-------

Added tests.


Thanks,

Ben Mahler


Re: Review Request 38608: Introduced an http::Connection for connection re-use and pipelining.

Posted by Ben Mahler <be...@gmail.com>.

> On Sept. 30, 2015, 1:32 a.m., Vinod Kone wrote:
> >

Thanks! I've simplified things and also caught two issues that were missed originally.


> On Sept. 30, 2015, 1:32 a.m., Vinod Kone wrote:
> > 3rdparty/libprocess/src/http.cpp, lines 1045-1059
> > <https://reviews.apache.org/r/38608/diff/1/?file=1079766#file1079766line1045>
> >
> >     this seems like a repeated pattern in this file. can this be a factory method on Socket?

It's only repeated because I split out https://reviews.apache.org/r/38609/ . After applying the subsequent review it's not repeated. Agreed that we will want to see if this warrants being pulled out though if we end up with duplication.


> On Sept. 30, 2015, 1:32 a.m., Vinod Kone wrote:
> > 3rdparty/libprocess/src/http.cpp, lines 1021-1042
> > <https://reviews.apache.org/r/38608/diff/1/?file=1079766#file1079766line1021>
> >
> >     Seems generally useful. Would it make sense to make this a factory method on Address class?
> >     
> >     Try<Address> create(const URL& url);

Yeah, although it seems a bit odd for Address to understand URL since we may have arbitrary things that can get converted to addresses.

One suggestion is to add this on URL:

```
class URL
{
  Try<Address> resolve(); // Or,
  Try<Address> address();
};
```

Added a TODO for follow-up.


> On Sept. 30, 2015, 1:32 a.m., Vinod Kone wrote:
> > 3rdparty/libprocess/src/http.cpp, line 976
> > <https://reviews.apache.org/r/38608/diff/1/?file=1079766#file1079766line976>
> >
> >     a comment on why you need 'false' here?

Thanks for the poke, this definitely warranted a comment!


> On Sept. 30, 2015, 1:32 a.m., Vinod Kone wrote:
> > 3rdparty/libprocess/src/http.cpp, lines 969-971
> > <https://reviews.apache.org/r/38608/diff/1/?file=1079766#file1079766line969>
> >
> >     lets pull process below to spawn, like we do in most of our code base?

Doing a grep reveals that we do this both ways, but I'll change it since your suggestion seems a bit more readable.


> On Sept. 30, 2015, 1:32 a.m., Vinod Kone wrote:
> > 3rdparty/libprocess/src/http.cpp, line 791
> > <https://reviews.apache.org/r/38608/diff/1/?file=1079766#file1079766line791>
> >
> >     why the temporary?
> >     
> >     can't you just do "return promise.future()"?

The promise is moved into the queue, so the return would have to be:

```
return std::get<1>(pipeline.back()).future();
```


> On Sept. 30, 2015, 1:32 a.m., Vinod Kone wrote:
> > 3rdparty/libprocess/src/http.cpp, line 832
> > <https://reviews.apache.org/r/38608/diff/1/?file=1079766#file1079766line832>
> >
> >     the whole disconnect(), closed() and fail() semantics are a bit hard to grok, esp around what calls what. can you think of a refactor that will make it easy? sorry, i don't have concrete suggestion yet.

Thanks for calling this out! This was definitely a difficulty when writing this.

I've now greatly simplified this by having just a single 'disconnected' method. I hope this reads a lot clearer now, have a look!


- Ben


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/38608/#review100717
-----------------------------------------------------------


On Sept. 22, 2015, 6:18 a.m., Ben Mahler wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/38608/
> -----------------------------------------------------------
> 
> (Updated Sept. 22, 2015, 6:18 a.m.)
> 
> 
> Review request for mesos, Benjamin Hindman, Jie Yu, and Vinod Kone.
> 
> 
> Bugs: MESOS-3332
>     https://issues.apache.org/jira/browse/MESOS-3332
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> In order to support connection re-use and pipelining of requests on a shared connection, this introduces the notion of an http::Connection.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/http.hpp fbd6cf7967173495875a8ea90ed28ade88b982a2 
>   3rdparty/libprocess/src/http.cpp 9ad613a16c379b6d76a9a0f8d6160fe23a182fd4 
>   3rdparty/libprocess/src/tests/http_tests.cpp d0b9399d38fa284466a012a21080b1d9007af98b 
> 
> Diff: https://reviews.apache.org/r/38608/diff/
> 
> 
> Testing
> -------
> 
> Added tests.
> 
> 
> Thanks,
> 
> Ben Mahler
> 
>


Re: Review Request 38608: Introduced an http::Connection for connection re-use and pipelining.

Posted by Vinod Kone <vi...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/38608/#review100717
-----------------------------------------------------------



3rdparty/libprocess/include/process/http.hpp (line 760)
<https://reviews.apache.org/r/38608/#comment157976>

    Can you add a comment here that this is forward declared? Stumped me for a bit.



3rdparty/libprocess/src/http.cpp (line 761)
<https://reviews.apache.org/r/38608/#comment157979>

    s/s/socket/ ?



3rdparty/libprocess/src/http.cpp (line 783)
<https://reviews.apache.org/r/38608/#comment157980>

    ditto.
    
    s/s/socket/



3rdparty/libprocess/src/http.cpp (line 791)
<https://reviews.apache.org/r/38608/#comment158358>

    why the temporary?
    
    can't you just do "return promise.future()"?



3rdparty/libprocess/src/http.cpp (line 819)
<https://reviews.apache.org/r/38608/#comment157981>

    s/, we/. We/



3rdparty/libprocess/src/http.cpp (line 832)
<https://reviews.apache.org/r/38608/#comment158371>

    the whole disconnect(), closed() and fail() semantics are a bit hard to grok, esp around what calls what. can you think of a refactor that will make it easy? sorry, i don't have concrete suggestion yet.



3rdparty/libprocess/src/http.cpp (line 886)
<https://reviews.apache.org/r/38608/#comment157985>

    Can you add a comment on when this is possible, considering the above if/else check?



3rdparty/libprocess/src/http.cpp (line 891)
<https://reviews.apache.org/r/38608/#comment158360>

    per line #915 this could also happen if connection close is received while there are pending requests right?



3rdparty/libprocess/src/http.cpp (lines 901 - 905)
<https://reviews.apache.org/r/38608/#comment158359>

    What's happening here? Can you add a comment?



3rdparty/libprocess/src/http.cpp (line 952)
<https://reviews.apache.org/r/38608/#comment157983>

    s/s/socket/



3rdparty/libprocess/src/http.cpp (line 955)
<https://reviews.apache.org/r/38608/#comment157984>

    Add a comment on what the tuple represents? esp. the streaming response part.



3rdparty/libprocess/src/http.cpp (line 960)
<https://reviews.apache.org/r/38608/#comment157982>

    s/closeConnection/close/ ?



3rdparty/libprocess/src/http.cpp (lines 969 - 971)
<https://reviews.apache.org/r/38608/#comment158361>

    lets pull process below to spawn, like we do in most of our code base?



3rdparty/libprocess/src/http.cpp (line 976)
<https://reviews.apache.org/r/38608/#comment158362>

    a comment on why you need 'false' here?



3rdparty/libprocess/src/http.cpp (lines 1021 - 1042)
<https://reviews.apache.org/r/38608/#comment157977>

    Seems generally useful. Would it make sense to make this a factory method on Address class?
    
    Try<Address> create(const URL& url);



3rdparty/libprocess/src/http.cpp (lines 1045 - 1059)
<https://reviews.apache.org/r/38608/#comment157978>

    this seems like a repeated pattern in this file. can this be a factory method on Socket?



3rdparty/libprocess/src/tests/http_tests.cpp (line 672)
<https://reviews.apache.org/r/38608/#comment158364>

    put Return on next line.



3rdparty/libprocess/src/tests/http_tests.cpp (line 689)
<https://reviews.apache.org/r/38608/#comment158366>

    s/request/response/ ?


- Vinod Kone


On Sept. 22, 2015, 6:18 a.m., Ben Mahler wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/38608/
> -----------------------------------------------------------
> 
> (Updated Sept. 22, 2015, 6:18 a.m.)
> 
> 
> Review request for mesos, Benjamin Hindman, Jie Yu, and Vinod Kone.
> 
> 
> Bugs: MESOS-3332
>     https://issues.apache.org/jira/browse/MESOS-3332
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> In order to support connection re-use and pipelining of requests on a shared connection, this introduces the notion of an http::Connection.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/http.hpp fbd6cf7967173495875a8ea90ed28ade88b982a2 
>   3rdparty/libprocess/src/http.cpp 9ad613a16c379b6d76a9a0f8d6160fe23a182fd4 
>   3rdparty/libprocess/src/tests/http_tests.cpp d0b9399d38fa284466a012a21080b1d9007af98b 
> 
> Diff: https://reviews.apache.org/r/38608/diff/
> 
> 
> Testing
> -------
> 
> Added tests.
> 
> 
> Thanks,
> 
> Ben Mahler
> 
>