yi

     沉睡的字符正在苏醒,0和1正在展示自然的魄力!

导航

linq to sql的性能和reader相比只是差一点点吗

     很多人认为linq to sql性能很不错,但我很可惜的告诉你,你错了,不是差一点点,是差非常多,差得让人可怕.

现把结果帖出来:

reader读取结果:

Report name:                  2010-6-22 23:01:24
Run on:                       2010-6-22 23:01:24
Run length:                   00:01:00

Web Application Stress Tool Version:1.1.293.1

Number of test clients:       1

Number of hits:               65919
Requests per Second:          1098.50

 

linq to sql读取的结果:

Report name:                  2010-6-22 23:03:05
Run on:                       2010-6-22 23:03:05
Run length:                   00:01:00

Web Application Stress Tool Version:1.1.293.1

Number of test clients:       1

Number of hits:               8673
Requests per Second:          144.54

我测试的数据库数据量:七十几W条,读取的数据为0

然后再测试有数据返回,返回记录数为两条,测试结果如下:

reader结果:

Report name:                  2010-6-22 23:17:10
Run on:                       2010-6-22 23:17:10
Run length:                   00:01:00

Web Application Stress Tool Version:1.1.293.1

Number of test clients:       1

Number of hits:               53138
Requests per Second:          885.63

 

linq to sql结果:

Report name:                  2010-6-22 23:15:50
Run on:                       2010-6-22 23:15:50
Run length:                   00:01:00

Web Application Stress Tool Version:1.1.293.1

Number of test clients:       1

Number of hits:               7161
Requests per Second:          119.35

 

然后多线程并发:

reader结果:

Report name:                  2010-6-22 23:28:15
Run on:                       2010-6-22 23:28:15
Run length:                   00:01:00

Web Application Stress Tool Version:1.1.293.1

Number of test clients:       1

Number of hits:               86210
Requests per Second:          1436.78

 

linq to sql结果:

Report name:                  2010-6-22 23:29:30
Run on:                       2010-6-22 23:29:30
Run length:                   00:01:01

Web Application Stress Tool Version:1.1.293.1

Number of test clients:       1

Number of hits:               14444
Requests per Second:          239.09

数据在上面,哥啥都不说了,性能差别大吗?数据在上面,我不想说。

为什么我只测试读取,其它不进行测试呢???读取的频率远高于插入,修改,删除,对于应用程序性能的问题大多数是出在读取,所以插入、修改、删除影响几乎影响不了应用程序性能,除了一些特殊的应用。

posted on 2010-06-22 23:24  yi  阅读(529)  评论(0编辑  收藏  举报