ab命令 分析JPetStore
ab命令
ab -n 100 -c 10
ab -n 100 -c 10 http://localhost:8081/jpetstore2/shop/viewItem.shtml?itemId=EST-6
ab -n 100 -c 10 http://localhost:8081/jpetstore6/actions/Catalog.action?viewItem=&itemId=EST-7
用JPetStore来测试
发现struts1 中的单例是对同一个session而言的 (如果action配的是scope="session"), 对于不同session是不同的实例。 基本上不存在synchronized的问题。
如果scope="request" 则每次请求都会生成一个实例
增加action的响应时间 用visualVM 来监控 heap大小
虽然其方法没有加synchronized,但是感觉系统自己加了?
需要看struts1的源代码
另外service类是每次new出来的, 所以如果在其成员变量中给个
private byte[] b =new byte[5*1024*1024];
一会就会出现OOM的异常