Hi Veb, Will it get logged into a log file or on the console? I tried to set the environment variables but could not find the log.
Thanks 在2023年12月19日星期二 UTC-8 11:02:06<veb...@google.com> 写道: > You can use environment variables to get more gRPC logging; See > https://github.com/grpc/grpc/blob/master/doc/environment_variables.md > I don't think spending 2 seconds to complete a simple RPC look good. > > On Friday, December 15, 2023 at 12:33:06 PM UTC-8 Frank Yu wrote: > >> Hi GRPC team, >> >> I tried to use grpc C++ with the package >> version Pkggrpc_cpp_1_29_1377_125. It is a simple "sayhello" >> implementation, and both the grpc client and grpc server are running on >> different services of the same node. >> >> The problem is that I found the sayhello request spent more than 2 >> seconds to complete. Which is far more than what I expected according to >> the benchmarking <https://grafana-dot-grpc-testing.appspot.com/?orgId=1>. >> >> >> Here's part of my code. >> *Client:* >> HRESULT >> SayHello(__in REQUEST* helloRequest, __inout RESPONSE* helloResponse) >> { >> std::shared_ptr<grpc::Channel> channel = >> grpc::CreateChannel("localhost:53002" >> , grpc::InsecureChannelCredentials()); >> >> std::unique_ptr<App_QADDisk::Stub> stub_(App_QADDisk::NewStub(channel)); >> >> ... >> >> // The actual RPC. >> *RD_TRACE_LOG((RD_TRACE_INFO, L"Calling gRPC request"));* >> Status status = stub_->SayHello(&context, request, &reply); >> *RD_TRACE_LOG((RD_TRACE_INFO, L"Returned gRPC request"));* >> ... >> } >> >> *Server:* >> class AppSayHelloImpl final : public App_SayHello::Service >> { >> >> grpc::Status >> SayHello(ServerContext* context, const >> Request* request, Response* response) override >> { >> >> * RDOS_INFO << L"Received request: " << request->testmessage();* >> std::string message = request->testmessage(); >> response->set_message(message); >> RDOS_INFO << L"returned."; >> return Status::OK; >> } >> }; >> >> *Logs:* >> Client: >> [2023/12/14, 06:02:46.536, INFO, 00019432] Calling gRPC request >> [2023/12/14, 06:02:48.567, INFO, 00019432] Returned gRPC request >> >> Server: >> [2023/12/14, 06:02:48.567, INFO, 00027292] Received request: test >> [2023/12/14, 06:02:48.567, INFO, 00027292] returned. >> >> >> Further logging shows that the flow from the client calling SayHello() to >> the Server trigger the SayHello() function took the 2 seconds. >> >> Questions: >> 1. Does GRPC client and server write internal logs? If it does, where I >> can find it on Windows? If not, how can I trace it. >> 2. Any idea about why it take so long sending the request from client to >> server? Is it expected? If not, how can I debugging/tracing it? >> >> Any response will be appreciated! >> >> >> Best regards, >> Frank >> >> >> >> >> >> >> -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/a5ef83b2-a9d5-4dd2-a6f8-bd0345ad0670n%40googlegroups.com.