????????tomcat???????????
???????????? ???????[ 2016/1/8 10:44:17 ] ??????????????? ???????
????????????????????????????????????????????????
?????·??
????tomcat???????request????????У????漰??cpu??IO???????IO??????cpu??????????У?????????????????????????в?????????????????????????IO???????ù???
????????С = ( (???io??? + ???cpu) / ???cpu time) * cpu????
?????????
???????io????100ms(IO???????????????????????????)?????cpu???10ms??????????????????4?????????????????????????????С?? ((100 + 10 )/10 ) *4 = 44???????????????????????????????????????????????IO????cpu??????
??????????
???????java ????????filter?????????????????request??????????
public class MoniterFilter implements Filter {
@Override
public void doFilter(ServletRequest request?? ServletResponse response??
FilterChain chain) throws IOException??
ServletException {
long start = System.currentTimeMillis();
String params = getQueryString(httpRequest);
try {
chain.doFilter(httpRequest?? httpResponse);
} finally {
logger.info("access url [{}{}]?? cost time [{}] ms )"?? uri??
params?? cost);
}
private String getQueryString(HttpServletRequest req) {
StringBuilder buffer = new StringBuilder("?");
Enumeration<String> emParams = req.getParameterNames();
try {
while (emParams.hasMoreElements()) {
String sParam = emParams.nextElement();
String sValues = req.getParameter(sParam);
buffer.append(sParam).append("=").append(sValues).append("&");
}
return buffer.substring(0?? buffer.length() - 1);
} catch (Exception e) {
}
return "";
}
}
??????????????????????IO?????jdk??cglib??
public class DaoInterceptor implements MethodInterceptor {
private static final Logger logger = LoggerFactory.getLogger(DaoInterceptor.class);
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
StopWatch watch = new StopWatch();
watch.start();
Object result = null;
Throwable t = null;
try {
result = invocation.proceed();
} catch (Throwable e) {
t = e == null ? null : e.getCause();
throw e;
} finally {
watch.stop();
logger.info("({}ms)"?? watch.getTotalTimeMillis());
}
return result;
}
}
????????????????????????????????????????С????
??????????????????????????????????£????????????????????loadrunner??jmeter???????·?????????????qps???????????????????????С??
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11