简体   繁体   English

如何衡量在NGen之前正确重新定义.NET程序集的效果?

[英]How to measure the effect of correctly rebasing .NET assemblies before NGen?

Our application has a lot of .NET assemblies, which up until now, has not been deployed with NGen-scripts, so they are always JITted at runtime. 我们的应用程序有很多.NET程序集,到目前为止,尚未使用NGen脚本进行部署,因此它们在运行时始终处于JIT状态。

Since our application is typically deployed to a terminal server, getting Windows to share binary images of the code is probably more optimal than the current way, so I'm looking at setting base addresses and NGen'ning the assemblies. 由于我们的应用程序通常部署到终端服务器,因此让Windows共享代码的二进制映像可能比当前方式更优化,所以我正在考虑设置基址和NGen'ning程序集。

So I ran the program without NGen whatsoever, and used [listdlls from SysInternals][1] to find the size of each, which I then increased to the next class of size (ie. xxxx --> 10000). 所以我在没有任何NGen的情况下运行程序,并使用[来自SysInternals的[listdlls] [1]查找每个的大小,然后我将其增加到下一个大小类(即xxxx - > 10000)。 I then laid out a memory list for all our assemblies, and adjusted the base addresses of them all. 然后我为所有程序集布置了一个内存列表,并调整了它们的基本地址。

So far so good, with listdlls I can now see that none of our assemblies are rebased at runtime. 到目前为止一直很好,有了listdlls我现在可以看到我们的程序集都没有在运行时重新定位。

However, how can I measure how much memory is actually shared between two instances? 但是,如何测量两个实例之间实际共享的内存量? Basically, let's say I start two instances of the program without having executed NGEN on the assemblies, and then after having executed NGEN, do it again. 基本上,假设我在没有在程序集上执行NGEN的情况下启动程序的两个实例,然后在执行NGEN之后再次执行。

What kind of numbers should I look at, and from which tool, in order to find the actual effect, if any? 我应该查看哪种数字,以及从哪个工具中查找实际效果(如果有的话)?

For instance, I'm aware of the fact that the very act of rebasing our assemblies might move 3rd party assemblies we use (DevExpress components for instance) around so that they suddenly must rebase, and then the whole thing is a wash. 例如,我知道这样一个事实,即重新组装我们的程序集的行为可能会移动我们使用的第三方程序集(例如DevExpress组件),以便它们突然必须重新绑定,然后整个事情就是清洗。

So, from where do I read which numbers? 那么,我从哪里读取哪些数字? Like, do I use the working set of task manager? 比如,我是否使用任务管理器的工作集? The private memory? 私人记忆? commit size? 提交大小? free memory before and after? 之前和之后的免费记忆?

Any advice? 有什么建议?

The only meaningful value for you will be Private Bytes of a process which is the number of bytes allocated (regardless of where) that are not shareable between processes. 对您而言,唯一有意义的值是进程的专用字节数,它是在进程之间不可共享的已分配字节数(无论在何处)。

I can't find a source but afair current .Net can also share (some) assemblies without being ngend. 我找不到一个消息来源,但是当前的.Net也可以共享(某些)程序集而不是ngend。

Edit: I would also be interested in your findings about the change of private bytes with and without ngening. 编辑:我也会对你有关使用和不使用ngening的私有字节更改的发现感兴趣。

Actually, it's no longer necessary to rebase on Vista or later. 实际上,不再需要在Vista或更高版本上进行重新设计。 See my answer to another post which refers to this Microsoft blog . 请参阅我对其他帖子的回答,该帖子引用了这个Microsoft博客 The blog explains, "with ASLR, while the final location is random per machine, it is the same for each process on the machine, which means the relocated data can be shared across all processes." 该博客解释说,“使用ASLR,虽然每台机器的最终位置是随机的,但机器上的每个进程都是相同的,这意味着可以在所有进程之间共享重新定位的数据。”

The whole process of rebasing is a bit hokey, so this is welcome news! 变装的整个过程有点过分,所以这是个好消息!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM