测试自定义的ORM解决方案的性能开销 - 如何? [英] Testing custom ORM solution performance overhead - how to?

查看:242
本文介绍了测试自定义的ORM解决方案的性能开销 - 如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试使用面向方面的编程(PostSHarp),实现持久性的无知创建一个自定义的ORM工具的原型(在编译时)。现在,我试图找出多少开销没有介绍与使用纯的DataReader和ADO.NET。我做了一个测试案例 - 插入,读取,在MS SQL Server 2008和MySQL社区版删除的数据(约1000条记录)。我使用纯ADO.NET和我的自定义工具,运行该测试多次。

I have created a prototype of a custom ORM tool using aspect oriented programming (PostSHarp) and achieving persistence ignorance (before compile-time). Now I tried to find out how much overhead does it introduce compared to using pure DataReader and ADO.NET. I made a test case - insert, read, delete data (about 1000 records) in MS SQL Server 2008 and MySQL Community Edition. I run this test multiple times using pure ADO.NET and my custom tool.

我预计结果将取决于许多因素 - 存储,交换,CPU,其他的流程,这样我跑的测试多次(20-40)。但结果真是出乎意料。他们只是不同的情况下的太多了。如果有只是一些极端值,我可以不理会他们(也许交换ocurred或不服。这样的),但他们是如此不同,我相信我不能相信这种测试。几乎有一半的时间我的ORM表现出比纯ADO.NET,更好地10%的性能有时是-10%。

I expected that results will depend on many factors - memory, swapping, CPU, other processes so I ran tests for many times (20-40). But the results were really unexpected. They just differed too much between those cases. If there were just some extreme values, I could ignore them (maybe swapping ocurred or smth. like that) but they were so different that I am sure I cannot trust this kind of testing. Almost half of times my ORM showed 10% better performance than pure ADO.NET, other times it was -10%.

有没有什么办法可以让这些测试的可信度?我没有功能强大的计算机有大量的内存,但也许我有点可以让MS SQL和MySQL或ADO.NET要尽可能一致,在这些测试?又有怎样的记录计数 - 这是更可靠,使用少量的记录和运行多次或其他方式

Is there any way I can make those tests reliable? I do not have a powerful computer with lots of memory, but maybe I somehow can make MS SQL and MySQL or ADO.NET to be as consistent as possible during those tests? And how about count of records - which is more reliable, using small amount of records and running more times or other way?

推荐答案

你见过 ORMBattle.NET ?请参见常见问题有的,也有涉及到测量的的性能开销由一个特定的ORM工具推出。测试套件开源

Have you seen ORMBattle.NET? See FAQ there, there are some ideas related to measuring performance overhead introduced by a particular ORM tool. Test suite is open source.

至于结果:

  • 在一些ORM工具自动批处理语句序列(即发送几个SQL语句在一起)。如果此功能在ORM实施得当,很容易通过2-4次打平ADO.NET的CRUD操作,如果ADO.NET测试不涉及配料。这两种情况下测试的ORMBattle.NET测试。
  • 这在很大程度上取决于你如何建立事务边界存在。请参阅 ORMBattle.NET常见问题解答细节。
  • CRUD测试不是最佳的性能指标都没有。在一般情况下,它是pretty的易得 峰可能性能这里,由于在一般情况下,必须的RDBMS做得比ORM得多于这种情况。
  • Some ORM tools automatically batch statement sequences (i.e. send several SQL statements together). If this feature is implemented well in ORM, it's easy to beat plain ADO.NET by 2-4 times on CRUD operations, if ADO.NET test does not involve batching. Tests on ORMBattle.NET test both cases.
  • A lot depends on how you establish transaction boundaries there. Please refer to ORMBattle.NET FAQ for details.
  • CRUD tests aren't best performance indicator at all. In general, it's pretty easy to get peak possible performance here, since in general, RDBMS must do much more than ORM in this case.

P.S。我ORMBattle.NET作者之一,所以如果你有兴趣的细节/可能作出的贡献,您可以直接联系我(或加入的 ORMBattle.NET谷歌论坛)。

P.S. I'm one of ORMBattle.NET authors, so if you're interested in details / possible contributions, you can contact me directly (or join ORMBattle.NET Google Groups).

这篇关于测试自定义的ORM解决方案的性能开销 - 如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆