kylin框架测试

总结:经测试freeze不同级别的优化,在性能有很大的差异,freeze不做任何,查询速度比hibernate快1倍以上,freeze经优化后,性能可以提升数十倍数。

 

下面是个简单的测试结果     


测试环境:笔记本 xp 数据库db2 连接池:最小30 最大100
测试对单张表的操作:10个字段,数据动态修改、增加

测试用例: 每次并发的操作:更新条数=(并发数/7*2)条,插入条数=(并发数/7*4)条 不 同的查询条件=(并发数/7)个 总的查询数目=并发数


并发数        总的运行时间     单个线程最小时间    结果集行数   缓存

500   freeze      totaltime=34797   singletime=18062   rows=17690   三级优化
200   freeze      totaltime=33500   singletime=6047    rows=17804   三级优化
100   freeze      totaltime=15953   singletime=5625    rows=17861   三级优化
50    freeze      totaltime=7172    singletime=5140    rows=17889   三级优化
30    freeze      totaltime=6641    singletime=5734    rows=17907   三级优化

30    freeze      totaltime=9828    singletime=8640    rows=17923   三级优化
50    freeze      totaltime=9234    singletime=5000    rows=17952   三级优化
100   freeze      totaltime=16907   singletime=5656    rows=18009   三级优化
200   freeze      totaltime=35078   singletime=6141    rows=18123   三级优化
500   freeze      totaltime=82016   singletime=5859    rows=18409   三级优化


500   freeze      totaltime=28172   singletime=5500    rows=13092   三级优化
1000  freeze      totaltime=52922   singletime=5688    rows=13661   三级优化

测试二:单表全查询
10    Hibernate   totaltime=58219   singletime=54657   rows=16900  
10    freeze      totaltime=28531   singletime=3672    rows=16900   不优化
3000  freeze      totaltime=9328    singletime=7203    rows=18409   三级优化

 

 测试代码:

public static void main(String[] args){
 try{
  
  new FreezeTest().init();
  printMemory();
   t=System.currentTimeMillis();
   int runThreadCount=6000;
  //int[] carg={1,3,5,10,20,30,50,100,150,200,500,1000,2000,3000};
  int[] carg={3000};    //设定并发数目
  int cacheModel=QueryMode.CACHE_LEVEL_3;
  for(int k=carg.length-1;k>=0;k--){
   runThreadCount=carg[k];
   new FreezeTest(cacheModel).run(runThreadCount);
   clearCache();    //清楚缓存
  }  
 }catch(Exception ex){
  ex.printStackTrace(); }
}
public  void run(int runCount)throws Exception{
 maxTotalTime=0;
 minTime=100000;
 count=0;
 t=System.currentTimeMillis();
 for(int i=0;i<runCount;i++){
  new Thread(this).start();    //启动并发线程
 }
 while(runCount>count){
  Thread.currentThread().sleep(1);    //等待并发线程结束
 }
  printf(runCount);
}

public List getList(String sql) throws Exception {
 try{
  Freeze freeze=FreezeFactory.getFreeze();
  Query query=freeze.createQuery();
  query.getQueryMode().setCacheMode(cacheModel);
  //并发执行不同的查询
  write.lock();
  i++;
  currentCount=i;
  String where="num>="+(currentCount%300)+" order by num";
  write.unlock();
  Dcode dcode=new Dcode();
  dcode.setDate("2009-05-08");
  dcode.setR1(currentCount);
  dcode.setR2(i);
  dcode.setR3(currentCount+i);
  dcode.setR4(currentCount);
  dcode.setR5(currentCount);
  dcode.setR5(currentCount);
  dcode.setAcode(where);
  dcode.setNum(currentCount%200);
  List<Dcode> l=null;
  if(currentCount%7==2){
   l= query.queryList(Dcode.class,where);  //有条件的查询
  }
  else if((currentCount%3)==1){
   freeze.createUpdate().update(dcode);  //更新数据
  }
  else{
   freeze.createUpdate().insert(dcode);  //插入数据
  } 
  if(l!=null)return l;
  l=query.queryList(Dcode.class);     //全表查询
  return l;
 }catch(Exception ex){
  ex.printStackTrace();
  
 }
 return null;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值