- 浏览: 295149 次
- 性别:
- 来自: 杭州
文章分类
最新评论
-
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 1888半静态语言 – 背景、原理和价值 (Semi-Static L ... -
Xml 的两类应用场景
2010-11-16 09:24 2331Xml 有两类应用场景 1 解析配置文件 这类场景侧重满 ... -
对敏捷的一点看法
2010-10-22 10:50 152410月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 6392使用Eclipse WTP进行快速Web开发(3) 在前 ... -
使用Eclipse WTP进行快速Web开发(2)-准备演示项目
2010-06-08 18:19 4262目前,很多项目基于 maven 进行开发,构建和发布。 而 ... -
使用Eclipse WTP进行快速Web开发(1) - 配置Tomcat
2010-06-08 18:18 8667使用Eclipse WTP进行快速We ... -
使用Eclipse WTP进行快速Web开发
2010-06-08 17:38 0使用Eclipse WTP进行快速Web开发 -
WebBeans 规范适合我们吗?
2010-02-28 21:23 1544JavaEE6 规范已经正式获得通过了,其中一个亮点就是 ... -
认识WebBean ---- 定义
2010-02-16 13:07 3711Gavin King在开发 Seam ... -
YY一下今年技术上想做的事情
2010-01-30 14:15 2902去年下半年除了基 ... -
Java同步锁一个技巧
2010-01-30 11:02 4769Synchronized 同步 Java5开始虽然引入了高 ... -
key-value 型数据库
2010-01-03 22:54 0key-value 型数据库 Tokyo Tyrant Li ... -
HSql的schema
2010-01-03 16:33 1379前段时间被HSql的Schema问题搞的头大。今天梳理一下 ... -
Bean copy性能对比
2009-10-18 00:43 0thread = 1, repeat = 100 TimedT ...
相关推荐
Jupyter-Notebook
Jupyter-Notebook
高效甘特图模板下载-精心整理.zip
lstm Summary Framework: z = U>x, x u Uz Criteria for choosing U: • PCA: maximize projected variance • CCA: maximize projected correlation • FDA: maximize projected intraclass variance
OpenGL调试工具,适合图形开发者,包括视频开发,播放器开始以及游戏开发者。
全国行政区划shp最新图.zip
全国研究生招生与在校数据+国家线-最新.zip
Jupyter-Notebook
直播电商交流平台 SSM毕业设计 附带论文 启动教程:https://www.bilibili.com/video/BV1GK1iYyE2B
《林黛玉进贾府》课本剧剧本
2000-2020年沪深A股上市公司融资约束程度SA指数-最新数据发布.zip
PPT模版资料,PPT模版资料
CPA注会考试最新教材资料-最新发布.zip
1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。
内容概要:本文提供了一个完整的职工管理系统的C++源代码。通过面向对象的编程方法,实现了包括创建新职工、查询、增加、修改、删除、排序、统计以及存储和恢复职工数据在内的多个基本操作功能。该系统支持不同的用户角色(如管理员与老板),并通过菜单驱动方式让用户方便地进行相关操作。此外,还包括了错误检测机制,确保操作过程中的异常得到及时处理。 适合人群:有一定C++语言基础,特别是面向对象编程经验的程序员;企业管理人员和技术开发人员。 使用场景及目标:适用于中小型企业内部的人力资源管理部门或IT部门,用于维护员工基本信息数据库,提高工作效率。通过本项目的学习可以加深对链表、类和对象的理解。 阅读建议:建议先熟悉C++的基本语法和面向对象概念,再深入学习代码的具体实现细节。对于关键函数,比如exchange、creatilist等,应当重点关注并动手实践以加强理解。
Jupyter-Notebook
考研公共课历年真题集-最新发布.zip
Huawei-HKUST Joint Workshop on Theory for Future Wireless 15-16 September 2022 华为-香港科技大学未来无线理论联合研讨会 Speaker:Jingwen Tong
演出人员与观众疫情信息管理系统 SSM毕业设计 附带论文 启动教程:https://www.bilibili.com/video/BV1GK1iYyE2B
《林黛玉进贾府》课本剧剧本.pdf