百度了一下,应该是第一次访问时需要建立一个连接,之后的一段时间由于已经建立了连接所以请求很快,请问下怎么解决第一次连接很慢的问题
CloseableHttpClient httpClient = (args != null && args.length == 1) ? getHttpClient(args[0]) : getHttpClient();
// 执行请求
CloseableHttpResponse response = httpClient.execute(httpPost);
现在spring已经提供了RestTemplate去做接口请求,使用也简单,耗时也不高
用openFegin吧