1*e07d83d3SAndroid Build Coastguard WorkergRPC ORCA Example 2*e07d83d3SAndroid Build Coastguard Worker================ 3*e07d83d3SAndroid Build Coastguard Worker 4*e07d83d3SAndroid Build Coastguard WorkerThe ORCA example consists of a Hello World client and a Hello World server. Out-of-the-box the 5*e07d83d3SAndroid Build Coastguard Workerclient behaves the same the hello-world version and the server behaves similar to the 6*e07d83d3SAndroid Build Coastguard Workerexample-hostname. In addition, they have been integrated with backend metrics reporting features. 7*e07d83d3SAndroid Build Coastguard Worker 8*e07d83d3SAndroid Build Coastguard Worker### Build the example 9*e07d83d3SAndroid Build Coastguard Worker 10*e07d83d3SAndroid Build Coastguard WorkerBuild the ORCA hello-world example client & server. From the `grpc-java/examples/examples-orca` 11*e07d83d3SAndroid Build Coastguard Workerdirectory: 12*e07d83d3SAndroid Build Coastguard Worker``` 13*e07d83d3SAndroid Build Coastguard Worker$ ../gradlew installDist 14*e07d83d3SAndroid Build Coastguard Worker``` 15*e07d83d3SAndroid Build Coastguard Worker 16*e07d83d3SAndroid Build Coastguard WorkerThis creates the scripts `build/install/example-orca/bin/custom-backend-metrics-client` and 17*e07d83d3SAndroid Build Coastguard Worker`build/install/example-orca/bin/custom-backend-metrics-server`. 18*e07d83d3SAndroid Build Coastguard Worker 19*e07d83d3SAndroid Build Coastguard Worker### Run the example 20*e07d83d3SAndroid Build Coastguard Worker 21*e07d83d3SAndroid Build Coastguard WorkerTo use ORCA, you have to instrument both the client and the server. 22*e07d83d3SAndroid Build Coastguard WorkerAt the client, in your own load balancer policy, you use gRPC APIs to install listeners to receive 23*e07d83d3SAndroid Build Coastguard Workerper-query and out-of-band metric reports. 24*e07d83d3SAndroid Build Coastguard WorkerAt the server, you add a server interceptor provided by gRPC in order to send per-query backend metrics. 25*e07d83d3SAndroid Build Coastguard WorkerAnd you register a bindable service, also provided by gRPC, in order to send out-of-band backend metrics. 26*e07d83d3SAndroid Build Coastguard WorkerMeanwhile, you update the metrics data from your own measurements. 27*e07d83d3SAndroid Build Coastguard Worker 28*e07d83d3SAndroid Build Coastguard WorkerThat's it! In this example, we simply put all the necessary pieces together to demonstrate the 29*e07d83d3SAndroid Build Coastguard Workermetrics reporting mechanism. 30*e07d83d3SAndroid Build Coastguard Worker 31*e07d83d3SAndroid Build Coastguard Worker1. To start the ORCA enabled example server on its default port of 50051, run: 32*e07d83d3SAndroid Build Coastguard Worker``` 33*e07d83d3SAndroid Build Coastguard Worker$ ./build/install/example-orca/bin/custom-backend-metrics-server 34*e07d83d3SAndroid Build Coastguard Worker``` 35*e07d83d3SAndroid Build Coastguard Worker 36*e07d83d3SAndroid Build Coastguard Worker2. In a different terminal window, run the ORCA enabled example client: 37*e07d83d3SAndroid Build Coastguard Worker``` 38*e07d83d3SAndroid Build Coastguard Worker$ ./build/install/example-orca/bin/custom-backend-metrics-client "orca tester" 1500 39*e07d83d3SAndroid Build Coastguard Worker``` 40*e07d83d3SAndroid Build Coastguard WorkerThe first command line argument (`orca tester`) is the name you wish to include in 41*e07d83d3SAndroid Build Coastguard Workerthe greeting request to the server and the second argument 42*e07d83d3SAndroid Build Coastguard Worker(`1500`) is the time period (in milliseconds) you want to run the client before it shut downed so that it will show 43*e07d83d3SAndroid Build Coastguard Workermore periodic backend metrics reports. You are expected to see the metrics data printed out. Try it! 44*e07d83d3SAndroid Build Coastguard Worker 45