- 浏览: 290632 次
- 性别:
- 来自: 杭州
文章分类
最新评论
-
msdn19880714:
楼主你是逗逼么,像你这样比较,直接被气死了
不小心被Cglib忽悠了(已纠正错误2009-3-1) -
javacainiaosc:
网上关于coherence的资料太少了,刚刚入手学习,感谢楼主 ...
Coherence企业级缓存(一) 特点 -
108439162:
不得不说,可能博主自己觉得这样做很牛逼了。但是你忘了依赖注入的 ...
我的开发经验分享(一)-Spring业务bean零配置 -
u010980147:
为什么不告诉我们要导入的包?你做截屏的时候顺道包impor ...
Mule web service调用中的复杂类型传递 -
bigtian:
现在办理社保转移好像没有当年这么麻烦了,国家出台了新的法律了。 ...
作为程序员看社保跨地区转移的问题
ConcurrentTest
Sourceforge Link: ConcurrentTest, 0.9.1
1. Description
- A java concurrent test library.
* It provides some base class which can simplify perfermance test for concurrent and multi-core program.
* Write code easily, and detailed CSV report is generated automatically.
* Most accurate result of multi-core program.
2. Design
This framework provides several classes to use.
Framework Class Description
1 AbstractRunner -
A abstract super class. You can write test class extends it.
2 RunnerFactory -
A abstract factory. You can extend it and override newRunner() method to create multi threads test runner.
3 ConcurrentTestMeter
A test meter. You cant use ConcurrentTestMeter.createMeter( poolSize, runnerFactory) to create a meter.
You can use concurrentTestMeter.runTest( n,count) to run the test.
4 ConcurrentTestReport -
The concurrent test report. It is created by ConcurrentTestMeter.
It can output CSV format report. You can edit it with Microsoft Excel easily.
3. Demo:
Java Relection Performance Test
(see org.bamboo.concurrenttest.demo.MethodInvokeTest for detailed)
Here is a sample to test java reflection under multi-core,multi thread senario.
1) Write code you want to test.
2) Use ConcurrentTestMeter class to run your test.
3) Write main() method.
4) Performance Test Report.
1) Write code you want to test.
Write a JavaReflectRunner class which extends from AbstractRunner class.
Override doWork(int) method to write logic you want to test,e.g. method.invoke(...)
2) Use ConcurrentTestMeter class to run your test. Provide a subclass of RunnerFactory which is in charge of create new JavaReflectRunner you just wrote.
3) Write main() method.
In main() method,you can provide thread pool size, concurrent count of threads and execution times per thread (i.e. run times).
On the whole,ConcurrentTestMeter class gives a full simulation of multi-thread enviroment.
You can specify thread pool size, concurrent theads, execute times as you need.
4) Performance Test Report.
Run main() method. You may get test result on the console. The output format is csv,so you can open it using Micorsof Excel and anylyze,make graph easily.
Test Result on console is below. The first line is column header, the sencond line is result. Maybe TPS index is what you want.
You can view it in Excel or make comaprison Graph.
Sorry, the parameter 200 of threads is just a test case to test concurrent performance of the code in doWork(int) method.
You can write a loop to use threads from 10 to 10000 step by double. e.g.
Then you will get a report which render then performance variation from threads 10 to 10000. And you can get the threads maximum on the machine from the curve.
why not shutdown threadpool? such as
executorService.shutdown()
It's to increase rapidly when repeated test..
You can also tuning the pool size in a loop the check the best parameter value on the machine , e.g. on a 8-core Xeon server.
Sorry, the parameter 200 of threads is just a test case to test concurrent performance of the code in doWork(int) method.
You can write a loop to use threads from 10 to 10000 step by double. e.g.
Then you will get a report which render then performance variation from threads 10 to 10000. And you can get the threads maximum on the machine from the curve.
Sourceforge Link: ConcurrentTest, 0.9.1
1. Description
- A java concurrent test library.
* It provides some base class which can simplify perfermance test for concurrent and multi-core program.
* Write code easily, and detailed CSV report is generated automatically.
* Most accurate result of multi-core program.
2. Design
This framework provides several classes to use.
Framework Class Description
1 AbstractRunner -
A abstract super class. You can write test class extends it.
2 RunnerFactory -
A abstract factory. You can extend it and override newRunner() method to create multi threads test runner.
3 ConcurrentTestMeter
A test meter. You cant use ConcurrentTestMeter.createMeter( poolSize, runnerFactory) to create a meter.
You can use concurrentTestMeter.runTest( n,count) to run the test.
4 ConcurrentTestReport -
The concurrent test report. It is created by ConcurrentTestMeter.
It can output CSV format report. You can edit it with Microsoft Excel easily.
3. Demo:
Java Relection Performance Test
(see org.bamboo.concurrenttest.demo.MethodInvokeTest for detailed)
Here is a sample to test java reflection under multi-core,multi thread senario.
1) Write code you want to test.
2) Use ConcurrentTestMeter class to run your test.
3) Write main() method.
4) Performance Test Report.
1) Write code you want to test.
Write a JavaReflectRunner class which extends from AbstractRunner class.
Override doWork(int) method to write logic you want to test,e.g. method.invoke(...)
package org.bamboo.concurrenttest.demo; import java.lang.reflect.Method; public class JavaReflectRunner extends AbstractRunner { private static Method method ; static { try { method = Foo.class.getMethod("sayHello", new Class<?>[]{ String.class }); } catch (Exception e) { } } public void doWork(int i) { try { Foo foo = new Foo(); method.invoke(foo, new Object[]{"ABCD" + i}); } catch (Exception e) { e.printStackTrace(); } } }
2) Use ConcurrentTestMeter class to run your test. Provide a subclass of RunnerFactory which is in charge of create new JavaReflectRunner you just wrote.
public class MethodInvokeTest { public static final int _threadPoolSize = 4; public static void testJavaReflect(int poolSize,int threads ,int runTimes) { ConcurrentTestMeter concurrentTestMeter = ConcurrentTestMeter.createMeter( poolSize, new RunnerFactory() { public Runner newRunner() { return new JavaReflectRunner(); } public String getTestName() { return "JavaReflectRunner"; } }); ConcurrentTestReport report = concurrentTestMeter.runTest( threads,runTimes); System.out.printf("%s \r\n" ,report.toCsvFormat()); }
3) Write main() method.
In main() method,you can provide thread pool size, concurrent count of threads and execution times per thread (i.e. run times).
On the whole,ConcurrentTestMeter class gives a full simulation of multi-thread enviroment.
You can specify thread pool size, concurrent theads, execute times as you need.
public static void main(String[] args) { int poolSize = 4; int concurrents = 200; int countPerThread = 10000; System.out.printf(ConcurrentTestReport.getHeader() +"\r\n"); testJavaReflect(poolSize,concurrents, countPerThread); testCglibReflect(poolSize,concurrents,countPerThread); System.out.println("\r\nMain exit..."); }
4) Performance Test Report.
Run main() method. You may get test result on the console. The output format is csv,so you can open it using Micorsof Excel and anylyze,make graph easily.
Test Result on console is below. The first line is column header, the sencond line is result. Maybe TPS index is what you want.
引用
Type,threadPoolSize ,Concurrency(threads),countPerThread, totalTime(ns),avgTime(ns),TPS:(times/s)
DirectMethodInvokeRunner,4,200,10000,863529862,431,2316
JavaReflectRunner,4,200,10000,1124753844,562,1778
CglibReflectRunner,4,200,10000,918106911,459,2178
DirectMethodInvokeRunner,4,200,10000,863529862,431,2316
JavaReflectRunner,4,200,10000,1124753844,562,1778
CglibReflectRunner,4,200,10000,918106911,459,2178
You can view it in Excel or make comaprison Graph.
评论
6 楼
amigo
2010-07-21
raymond2006k 写道
billgui 写道
Thanks for sharing. Do you have an estimation on how many threads maximum one machine can handle? I see 200 in your sample data, not sure if this is an average data or?
Sorry, the parameter 200 of threads is just a test case to test concurrent performance of the code in doWork(int) method.
You can write a loop to use threads from 10 to 10000 step by double. e.g.
public static void main(String[] args) { int concurrents= 10 ; System.out.printf(ConcurrentTestReport.getHeader() +"\r\n"); while( concurrents<10000) { testCglibReflect(poolSize,concurrents,countPerThread); concurrents = concurrents * 2; } System.out.println("\r\nMain exit..."); }
Then you will get a report which render then performance variation from threads 10 to 10000. And you can get the threads maximum on the machine from the curve.
why not shutdown threadpool? such as
executorService.shutdown()
It's to increase rapidly when repeated test..
5 楼
numen_wlm
2010-07-13
装,装,装,使劲儿装。
4 楼
raymond2006k
2010-07-12
billgui 写道
Thanks for sharing. Do you have an estimation on how many threads maximum one machine can handle? I see 200 in your sample data, not sure if this is an average data or?
You can also tuning the pool size in a loop the check the best parameter value on the machine , e.g. on a 8-core Xeon server.
3 楼
raymond2006k
2010-07-12
billgui 写道
Thanks for sharing. Do you have an estimation on how many threads maximum one machine can handle? I see 200 in your sample data, not sure if this is an average data or?
Sorry, the parameter 200 of threads is just a test case to test concurrent performance of the code in doWork(int) method.
You can write a loop to use threads from 10 to 10000 step by double. e.g.
public static void main(String[] args) { int concurrents= 10 ; System.out.printf(ConcurrentTestReport.getHeader() +"\r\n"); while( concurrents<10000) { testCglibReflect(poolSize,concurrents,countPerThread); concurrents = concurrents * 2; } System.out.println("\r\nMain exit..."); }
Then you will get a report which render then performance variation from threads 10 to 10000. And you can get the threads maximum on the machine from the curve.
2 楼
xiaoyuqi00
2010-07-12
Can you speak chinese?
1 楼
billgui
2010-07-12
Thanks for sharing. Do you have an estimation on how many threads maximum one machine can handle? I see 200 in your sample data, not sure if this is an average data or?
发表评论
-
Velocity常见问题
2011-02-09 11:31 01. foreach循环里set临 时变量碰到null的问题 ... -
Web安全纪要
2011-01-25 17:05 01.HttpOnly Using Java to Set H ... -
Eclipse 插件开发技巧
2010-12-19 13:42 01. 菜单和toolbar <action ... -
InfoQ刚发表一篇论文《半静态语言–原理和价值分析》
2010-12-11 22:38 1817半静态语言 – 背景、原理和价值 (Semi-Static L ... -
Xml 的两类应用场景
2010-11-16 09:24 2268Xml 有两类应用场景 1 解析配置文件 这类场景侧重满 ... -
对敏捷的一点看法
2010-10-22 10:50 147810月14日敏捷中国2010 ... -
Apache项目提交流程
2010-08-21 09:47 0要将自己的项目提交给A ... -
Java应用性能问题技巧
2010-07-28 14:38 01. XML 解析时,会到 jar/META-INF/ 下去找 ... -
maven archetype 创建
2010-07-15 09:40 01. 创建一个 archetype 项目 mvn arche ... -
使用Eclipse WTP进行快速Web开发(3)- 开发演示
2010-06-09 13:08 6332使用Eclipse WTP进行快速Web开发(3) 在前 ... -
使用Eclipse WTP进行快速Web开发(2)-准备演示项目
2010-06-08 18:19 4217目前,很多项目基于 maven 进行开发,构建和发布。 而 ... -
使用Eclipse WTP进行快速Web开发(1) - 配置Tomcat
2010-06-08 18:18 8606使用Eclipse WTP进行快速We ... -
使用Eclipse WTP进行快速Web开发
2010-06-08 17:38 0使用Eclipse WTP进行快速Web开发 -
WebBeans 规范适合我们吗?
2010-02-28 21:23 1455JavaEE6 规范已经正式获得通过了,其中一个亮点就是 ... -
认识WebBean ---- 定义
2010-02-16 13:07 3649Gavin King在开发 Seam ... -
YY一下今年技术上想做的事情
2010-01-30 14:15 2783去年下半年除了基 ... -
Java同步锁一个技巧
2010-01-30 11:02 4621Synchronized 同步 Java5开始虽然引入了高 ... -
key-value 型数据库
2010-01-03 22:54 0key-value 型数据库 Tokyo Tyrant Li ... -
HSql的schema
2010-01-03 16:33 1315前段时间被HSql的Schema问题搞的头大。今天梳理一下 ... -
Bean copy性能对比
2009-10-18 00:43 0thread = 1, repeat = 100 TimedT ...
相关推荐
java并发测试 代码很简单,就是一个test类 原理是这样的 1、定义并发数n 2、创建1、2、3……n个线程,创建后悬停 3、所有线程创建好后,...代码的框架已经写好了,只要在代码注释的地方加入自己想要测试的内容就可以了
Chhd 并发测试报告 一、测试目的 1、测试典型页面能支持的最大并发用户数。 2、测试典型页面在响应时间为10s 的时间内,能支持的最大并发数。 二、选择的典型页面及并发点 1、登录首页http://192.168.1.10。并发点:...
代码只有几行,实现s3上传并发与下载并发,是ceph s3接口测试工具。欢迎下载,需要3分哦。 s3接口并发测试工具 s3上传并发测试 s3下载并发测试 s3并发测试
这篇文章主要介绍了python多线程并发及测试框架案例,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下 1、循环创建多个线程,并通过循环启动执行 import ...
WEB API 多线程并发测试工具; WEB API 多线程并发测试工具
海量并发微服务框架设计
HTTP高并发测试工具
4.完全多线程 框架允许通过多个线程并发取样和 通过单独的线程组对不同的功能同时取样。 5.精心的GUI设计允许快速操作和更精确的计时。 6.缓存和离线分析/回放测试结果。 JMeter的高可扩展性 1.可链接的取样器允许...
并发处理框架,并发处理框架,并发处理框架
web并发测试报告:包含并发用户数,吞吐率,请求等待时间,请求响应时间
ab 的全称是 ApacheBench , 是 Apache 附带的一个小工具 , 专门用于 HTTP Server 的 benchmark testing , 可以同时模拟多个并发请求。
内网并发测试工具,可以测试接口的并发功能,实现断点调试,判断代码是否有误。
Jemter多用户并发测试。
Apache 压力测试工具ab 专注接口测试 并发测试Apache 压力测试工具ab 专注接口测试 并发测试
内网并发测试工具,做接口测试必备工具,内网调试,高并发调试测试工具
WebSocket压力并发测试v1.1.2,主要用于测试并发连接数的
1.Jmeter对HTTP请求压力测试、并发测试的简单使用方法 2.HTTP请求压力测试、并发测试的简单使用方法 3.Jmeter对HTTP请求压力测试、并发测试的简单使用方法
一款定制的压测工具, 对webapi webserver 等一些借口进行压测 , 可以自定义并发数量.
一套开源的服务器集群分布式大数据高并发的快速开发框架,使用mongodb内存数据库,二级缓存技术。