bigcommerce / gruf

gRPC Ruby Framework
https://github.com/bigcommerce/gruf
MIT License
626 stars 73 forks source link

Add rake task for demoing concurrent calls to server #207

Closed splittingred closed 8 months ago

splittingred commented 8 months ago

What? Why?

Adds a concurrency rake task for demoing a bunch of calls to a server that has three different gRPC services loaded. Takes an optional argument for # of calls per service, and spreads out the calls via a rand sleep call.

How was it tested?

First, start the demo server: ./spec/demo_server. Then, in a separate terminal, run: bundle exec rake gruf:demo:concurrent

I, [2024-02-22T14:48:19.624032 #20119]  INFO -- : - Service1 (84): Making call to Get1
I, [2024-02-22T14:48:19.624078 #20119]  INFO -- : - Service3 (73): Making call to Get3
I, [2024-02-22T14:48:19.624968 #20119]  INFO -- : - Service1 (56): Making call to Get1
I, [2024-02-22T14:48:19.625222 #20119]  INFO -- : - Service2 (45): Making call to Get2
I, [2024-02-22T14:48:19.630094 #20119]  INFO -- : Got response from server in client interceptor rpc.test.service3.get3 of type request_response: 2.35ms
I, [2024-02-22T14:48:19.630533 #20119]  INFO -- : -- Service3 (73): <Rpc::Test::Product3: id: 73, name: "Lavonne">
I, [2024-02-22T14:48:19.630612 #20119]  INFO -- : Got response from server in client interceptor rpc.test.service1.get1 of type request_response: 5.31ms
I, [2024-02-22T14:48:19.630665 #20119]  INFO -- : -- Service1 (84): <Rpc::Test::Product1: id: 84, name: "Kaycee">
I, [2024-02-22T14:48:19.630924 #20119]  INFO -- : Got response from server in client interceptor rpc.test.service2.get2 of type request_response: 4.19ms
I, [2024-02-22T14:48:19.630946 #20119]  INFO -- : -- Service2 (45): <Rpc::Test::Product2: id: 45, name: "Monica">
I, [2024-02-22T14:48:19.631213 #20119]  INFO -- : Got response from server in client interceptor rpc.test.service1.get1 of type request_response: 3.79ms
I, [2024-02-22T14:48:19.631277 #20119]  INFO -- : -- Service1 (56): <Rpc::Test::Product1: id: 56, name: "Cordelia">
I, [2024-02-22T14:48:19.632400 #20119]  INFO -- : - Service1 (16): Making call to Get1
I, [2024-02-22T14:48:19.633719 #20119]  INFO -- : Got response from server in client interceptor rpc.test.service1.get1 of type request_response: 1.26ms
I, [2024-02-22T14:48:19.633741 #20119]  INFO -- : -- Service1 (16): <Rpc::Test::Product1: id: 16, name: "Sol">
I, [2024-02-22T14:48:19.666583 #20119]  INFO -- : - Service1 (50): Making call to Get1
I, [2024-02-22T14:48:19.668201 #20119]  INFO -- : Got response from server in client interceptor rpc.test.service1.get1 of type request_response: 1.51ms
I, [2024-02-22T14:48:19.668230 #20119]  INFO -- : -- Service1 (50): <Rpc::Test::Product1: id: 50, name: "Melony">
I, [2024-02-22T14:48:19.675397 #20119]  INFO -- : - Service1 (65): Making call to Get1
I, [2024-02-22T14:48:19.676688 #20119]  INFO -- : Got response from server in client interceptor rpc.test.service1.get1 of type request_response: 1.22ms
I, [2024-02-22T14:48:19.676719 #20119]  INFO -- : -- Service1 (65): <Rpc::Test::Product1: id: 65, name: "Evita">
I, [2024-02-22T14:48:19.687445 #20119]  INFO -- : - Service2 (51): Making call to Get2
I, [2024-02-22T14:48:19.687463 #20119]  INFO -- : - Service1 (15): Making call to Get1
I, [2024-02-22T14:48:19.689125 #20119]  INFO -- : - Service2 (71): Making call to Get2
I, [2024-02-22T14:48:19.689545 #20119]  INFO -- : Got response from server in client interceptor rpc.test.service1.get1 of type request_response: 1.63ms
I, [2024-02-22T14:48:19.689569 #20119]  INFO -- : -- Service1 (15): <Rpc::Test::Product1: id: 15, name: "Sade">
I, [2024-02-22T14:48:19.689701 #20119]  INFO -- : Got response from server in client interceptor rpc.test.service2.get2 of type request_response: 2.16ms
I, [2024-02-22T14:48:19.689732 #20119]  INFO -- : -- Service2 (51): <Rpc::Test::Product2: id: 51, name: "Arica">
I, [2024-02-22T14:48:19.690450 #20119]  INFO -- : Got response from server in client interceptor rpc.test.service2.get2 of type request_response: 1.25ms
I, [2024-02-22T14:48:19.690469 #20119]  INFO -- : -- Service2 (71): <Rpc::Test::Product2: id: 71, name: "Concetta">
I, [2024-02-22T14:48:19.698814 #20119]  INFO -- : - Service2 (24): Making call to Get2
I, [2024-02-22T14:48:19.700571 #20119]  INFO -- : Got response from server in client interceptor rpc.test.service2.get2 of type request_response: 1.65ms
I, [2024-02-22T14:48:19.700618 #20119]  INFO -- : -- Service2 (24): <Rpc::Test::Product2: id: 24, name: "Kaye">

# and so forth...
codeclimate[bot] commented 8 months ago

Code Climate has analyzed commit 1d73ad81 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 96.4% (0.0% change).

View more on Code Climate.