Another question is whether this is the same the second time you create a
channel.  The first time, the JVM may be taking time doing class loading.

On Tue, Aug 22, 2023 at 8:41 AM 'Yuri Golobokov' via grpc.io <
grpc-io@googlegroups.com> wrote:

> Hello,
> What is the round-trip time? How much time does DNS resolution take?
>
> On Tuesday, August 22, 2023 at 12:02:21 AM UTC-7 邹会江 wrote:
>
>> ### JAVA Code
>>
>> ```
>>             channel =
>> ManagedChannelBuilder.forTarget(param.getTarget()).build();
>>             long channelStart = System.currentTimeMillis();
>>             asyncStub = ASRRouteGrpc.newStub(channel);
>>             asrResponseStreamObserver = new
>> ASRResponseStreamObserver(speechTranscriberListener);
>>             requestObserver = asyncStub.route(asrResponseStreamObserver);
>>             RouteRequest requestConf = newRequestHead(param);
>>             traceId = requestConf.getAsrConfig().getTraceId();
>>             ConnectivityState currentChannelState =
>> channel.getState(true);
>>             while (currentChannelState != ConnectivityState.READY) {
>>                 CountDownLatch latchUntilChannelReady = new
>> CountDownLatch(1);
>>                 channel.notifyWhenStateChanged(currentChannelState,
>> latchUntilChannelReady::countDown);
>>                 latchUntilChannelReady.await();
>>                 currentChannelState = channel.getState(true);
>>                 if (currentChannelState == ConnectivityState.CONNECTING) {
>>                     long channelConnecting = System.currentTimeMillis();
>>                     LOGGER.info("The transition from idle state to
>> connecting takes: {} ms", channelConnecting - channelStart);
>>                 }
>>             }
>>             long channelReady = System.currentTimeMillis();
>>             if (LOGGER.isInfoEnabled()) {
>>                 LOGGER.info("Trace id: {}, channel start time: {},
>> channel ready time: {}, creating channel takes: {} ms", traceId,
>> channelStart, channelReady,
>>                         channelReady - channelStart);
>>             }
>> ```
>> ### LOGGER
>>
>> ```
>> 2023-08-22 14:12:34,816 INFO  client.ASRClient - The transition from idle
>> state to connecting takes: 1009 ms
>> 2023-08-22 14:12:34,841 INFO  client.ASRClient - Trace id:
>> 6afd2c67-e8c5-4cea-bd5c-4b82591a52aa, channel start time: 1692684753807,
>> channel ready time: 1692684754841, creating channel takes: 1034 ms
>> ```
>> ### Description
>> #### code logic
>> 1. first create channel
>> 2. mark a time stamp(channelStart) after the channel is created
>> 3. get the state of channel ,the state is IDEL
>> 4. when the state of channel changes from IDEL to CONNECTING,mark a time
>> stamp(channelConnecting)
>> 5. when the state of channel changes from CONNECTING to READY, mark a
>> time stamp(channelReady)
>>
>> #### Log info
>> 1. It takes 1009ms for channel from IDLE state to CONNECTING state.
>> 2. It takes 25ms for channel from CONNECTIONG state to READY state.
>> ### What's i supposed
>> 1. Does it take too long for a channel to change from IDLE to CONNECTING?
>> 2. I want to reduce the time it takes for a channel to go from IDLE to
>> CONNECTING.
>>
> --
> 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/8f2a15b8-1541-422e-ad66-9a5778e53882n%40googlegroups.com
> <https://groups.google.com/d/msgid/grpc-io/8f2a15b8-1541-422e-ad66-9a5778e53882n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CANuT3qXXzcTGFiAFPniyfES84VGKtL4BWcnXK_YB4Lss1N17ig%40mail.gmail.com.

Reply via email to