search

Home  >  Q&A  >  body text

java - Why does the execution of this code occasionally reach 50~100ms?

    for(Map.Entry<String, String> entry : map.entrySet()) { //map 最多2个key-value对
        Request request = new Request();

        ClientInfo clientInfo = new ClientInfo(clientid, host, ip);

        String value = entry.getValue();
        RealInfo realInfo = new RealInfo(clientId, value , clientInfo);
        request.realInfo = realInfo ;

        concurrentLinkedQueue.add(request);
    }
}

jre is a 1.7 environment, and 1.6 is used for compilation.
Looking at the monitoring, most of them return within 0~1ms, but some of them return within 50~100ms, and the qps is about 800.
Now we have ruled out CPU load, memory, network card and other reasons
I really can’t figure out why it can reach 50ms. . . Please help me analyze it

黄舟黄舟2731 days ago840

reply all(1)I'll reply

  • 欧阳克

    欧阳克2017-07-03 11:45:18

    It may be a problem with the database connection. After the IP parameter is changed, will there be any processing in the database to cause this delay? I have encountered similar problems before, but later found out that it is a problem with the database

    reply
    0
  • Cancelreply