SWJTU-ZhangLei commented on issue #4589: URL: https://github.com/apache/doris/issues/4589#issuecomment-1396626757
> i can always make it happen in my test env. 1fe , 3be . now cost 40s  > > all costs come to "com.sleepycat.je.rep.elections.Learner$3:execute()" > > ``` > `---ts=2020-11-01 03:04:21;thread_name=doris-mysql-nio-pool-53;id=12d9;is_daemon=true;priority=5;TCCL=sun.misc.Launcher$AppClassLoader@355da254 > `---[10016.334144ms] com.sleepycat.je.rep.elections.Learner:findMaster() > +---[0.119069ms] com.sleepycat.je.rep.elections.Protocol$MasterQuery:<init>() #400 > +---[1.034996ms] com.sleepycat.je.rep.elections.Utils:broadcastMessage() #401 > +---[0.025156ms] com.sleepycat.je.rep.elections.Protocol:getReadTimeout() #408 > +---[0.036242ms] com.sleepycat.je.rep.elections.Learner$3:<init>() #408 > +---[10013.985054ms] com.sleepycat.je.rep.elections.Learner$3:execute() #432 > `---[0.027025ms] com.sleepycat.je.rep.elections.Protocol$MasterQueryResponse:getValue() #447 > ``` > > the slow code as bellow > > ```java > static public MasterValue findMaster > (final Protocol protocol, > Set<InetSocketAddress> learnerSockets, > final Logger logger, > final RepImpl repImpl, > final Formatter formatter ) > throws UnknownMasterException { > > if (learnerSockets.size() <= 0) { > return null; > } > int threadPoolSize = Math.min(learnerSockets.size(), 10); > final ExecutorService pool = > Executors.newFixedThreadPool(threadPoolSize); > try { > FutureTrackingCompService<MessageExchange> compService = > Utils.broadcastMessage(learnerSockets, > Learner.SERVICE_NAME, > protocol.new MasterQuery(), > pool); > > final List<MasterQueryResponse> results = new LinkedList<>(); > new Utils.WithFutureExceptionHandler<MessageExchange> > (compService, 2 * protocol.getReadTimeout(), TimeUnit.MILLISECONDS, > logger, repImpl, formatter) { > > @Override > protected void processResponse(MessageExchange me) { > > final ResponseMessage response = me.getResponseMessage(); > > if (response.getOp() == > protocol.MASTER_QUERY_RESPONSE){ > results.add((MasterQueryResponse)response); > } else { > LoggerUtils.logMsg(logger, repImpl, formatter, > Level.WARNING, > "Unexpected MasterQuery response:" + > response.wireFormat()); > } > } > > @Override > protected boolean isShutdown() { > return (repImpl != null) && !repImpl.isValid(); > } > > }.execute(); > > MasterQueryResponse bestResponse = null; > for (MasterQueryResponse result : results) { > if ((bestResponse == null) || > (result.getProposal(). > compareTo(bestResponse.getProposal()) > 0)) { > bestResponse = result; > } > } > if (bestResponse == null) { > throw new UnknownMasterException > ("Could not determine master from helpers at:" + > learnerSockets.toString()); > } > return(MasterValue) bestResponse.getValue(); > } finally { > pool.shutdownNow(); > } > } > ``` Can you describe the step for how to reproduce the problem? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org