首页 > 应用开发 > Java > 分享一次分析/解决支付应用性能问题的全过程
(7)和(8)。也就是应用服务器(Tomcat)通过Http(https) Connector转发请求到Spring容器,然后Spring容器通过Spring框架的DispatcherServlet转发请求到相应的bean的业务方法。
(10)这段。也就是从Spring中的bean方法发送请求mapi.XXX.com这个web service调用中间的网络。
(11)这段。也就是技术部接口本身调用服务的耗时。
JAVA平台本身的性能问题。
代码中Web Service连接使用后未关闭导致连接过多响应变慢。
内存泄露导致服务器性能急剧下降。
Full GC导致特定时间内服务器性能奇差无比。
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
public static HttpClientResponsegetMethod(String url) {
HttpClient client = newHttpClient();
StringBuilder resContentBuf = newStringBuilder();
GetMethod method = newGetMethod(url);
// Provide custom retry handler is necessary
method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, newDefaultHttpMethodRetryHandler(3, false));
intstatusCode = 0;
try {
statusCode = client.executeMethod(method);
if (statusCode == HttpStatus.SC_OK || statusCode == 400) {
resContentBuf.append(method.getResponseBodyAsString());
}
} catch (Exception e) {
e.printStackTrace();
} finally {
method.releaseConnection();
}
logger.info("HttpClientUtil.getMethod,the json data:"+resContentBuf.toString());
return assembleResponse(resContentBuf.toString(),statusCode);
}
|
|
1
2
3
4
5
6
7
8
9
10
|
protocol="org.apache.coyote.http11.Http11NioProtocol"
connectionTimeout="20000"
URIEncoding="UTF-8"
useBodyEncodingForURI="true"
maxThreads="768"
minSpareThreads="64"
enableLookups="false"
redirectPort="8443" />
|
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26477398/viewspace-1624697/ ,如需转载,请注明出处,否则将追究法律责任。