Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust: add demo Tonic server #4318

Merged
merged 11 commits into from
Nov 12, 2020
Merged

rust: add demo Tonic server #4318

merged 11 commits into from
Nov 12, 2020

Commits on Nov 11, 2020

  1. rust: add tonic dependency stack

    Summary:
    This includes: `tonic`, a gRPC framework; `tonic-build`, its compiler
    for protobuf bindings; `tokio`, an async runtime; and `async-stream`,
    `async-trait`, and `futures-core`, helpers for streaming gRPC methods.
    
    Test Plan:
    All crates build without any manual configuration:
    
    ```
    bazel build //third_party/rust:{tonic{,_build},tokio,async_{stream,trait},futures_core}
    ```
    
    wchargin-branch: rust-dep-tonic-stack
    wchargin-source: 0fa8ea005745e7194bde20da6fb1b9871c05822a
    wchargin committed Nov 11, 2020
    Configuration menu
    Copy the full SHA
    f3544ed View commit details
    Browse the repository at this point in the history
  2. rust: compile gRPC bindings with Tonic

    Summary:
    This patch switches our Rust protocol buffer bindings from `prost-build`
    to `tonic-build`. This generates the same protobuf message types, since
    Tonic interoperates with Prost, but can now also generate gRPC stubs.
    
    Test Plan:
    Check the doc server to see that our existing proto types still look
    good, in the `rustboard_core::proto::tensorboard` package. We don’t have
    gRPC services to generate yet. A follow-up commit will add a demo server
    as proof of concept.
    
    wchargin-branch: rust-compile-grpc
    wchargin-source: c5090247a8a25c1902d4b42597ec4d4ae2593779
    wchargin committed Nov 11, 2020
    Configuration menu
    Copy the full SHA
    dacd2fe View commit details
    Browse the repository at this point in the history
  3. rust: add demo Tonic server

    Summary:
    This patch defines a simple “demo” service with one RPC, which adds a
    sequence of numbers. It includes a Tonic server for this service to
    demonstrate the end-to-end setup.
    
    Test Plan:
    In one shell, run `bazel run -c opt //tensorboard/data/server`. In
    another shell, use `grpc_cli` to send an RPC to localhost port 6789:
    
    ```
    grpc_cli --channel_creds_type=insecure \
        --protofiles tensorboard/data/server/demo.proto \
        call localhost:6789 Demo.Add "term: 2 term: 2"
    ```
    
    This should print a response like `sum: 4`. On my machine, it completes
    in 5.2 ± 2.6 ms (methodology: run `hyperfine` on the above command).
    This seems reasonably fast given that it has to establish a connection,
    whereas a Python gRPC client will keep a connection open. It’s also well
    below the 40ms magic number for `TCP_NODELAY` issues.
    
    wchargin-branch: rust-demo-tonic-server
    wchargin-source: 25d9fcbf2279742cdffde0c5357711244e9afef2
    wchargin committed Nov 11, 2020
    Configuration menu
    Copy the full SHA
    155c40c View commit details
    Browse the repository at this point in the history

Commits on Nov 12, 2020

  1. [update diffbase]

    wchargin-branch: rust-compile-grpc
    wchargin-source: 6d888a758d42d318467189245ebcc619acaefe9c
    wchargin committed Nov 12, 2020
    Configuration menu
    Copy the full SHA
    bb1f37a View commit details
    Browse the repository at this point in the history
  2. [update diffbase]

    wchargin-branch: rust-demo-tonic-server
    wchargin-source: 2181a31c718433d5113cbb1fe2e51c7c98193cc1
    wchargin committed Nov 12, 2020
    Configuration menu
    Copy the full SHA
    864fd26 View commit details
    Browse the repository at this point in the history
  3. [update patch]

    wchargin-branch: rust-demo-tonic-server
    wchargin-source: 2181a31c718433d5113cbb1fe2e51c7c98193cc1
    wchargin committed Nov 12, 2020
    Configuration menu
    Copy the full SHA
    d743728 View commit details
    Browse the repository at this point in the history
  4. [update patch]

    wchargin-branch: rust-compile-grpc
    wchargin-source: ba5e9a59b4b4f95e86b1f7a4a0b0d5c28c446476
    wchargin committed Nov 12, 2020
    Configuration menu
    Copy the full SHA
    6a5ef83 View commit details
    Browse the repository at this point in the history
  5. [update diffbase]

    wchargin-branch: rust-demo-tonic-server
    wchargin-source: 89356565a9557266c069dcfdf0422f2e2225e3ab
    
    # Conflicts:
    #	tensorboard/data/server/gen_protos_tool.rs
    wchargin committed Nov 12, 2020
    Configuration menu
    Copy the full SHA
    984ad35 View commit details
    Browse the repository at this point in the history
  6. [update patch]

    wchargin-branch: rust-demo-tonic-server
    wchargin-source: 89356565a9557266c069dcfdf0422f2e2225e3ab
    wchargin committed Nov 12, 2020
    Configuration menu
    Copy the full SHA
    3ef1476 View commit details
    Browse the repository at this point in the history
  7. [update diffbase]

    wchargin-branch: rust-demo-tonic-server
    wchargin-source: eb0bce9732ce4810d7152ec6eb47ba67a8d85d5e
    
    # Conflicts:
    #	tensorboard/data/server/gen_protos_tool.rs
    wchargin committed Nov 12, 2020
    Configuration menu
    Copy the full SHA
    395bda0 View commit details
    Browse the repository at this point in the history
  8. [update patch]

    wchargin-branch: rust-demo-tonic-server
    wchargin-source: eb0bce9732ce4810d7152ec6eb47ba67a8d85d5e
    wchargin committed Nov 12, 2020
    Configuration menu
    Copy the full SHA
    50fa124 View commit details
    Browse the repository at this point in the history