Question

I am currently trying to calculate whether NGEN would have any benefit for our .NET client in terms of memory savings when running on a Citrix farm.

My primary reference is the following article:

This article suggests that using VMMap I just need to check to see if my shareable WS increases and I'm golden.

In fact I do see an increase of about 56MB in shareable WS (refer to Before and After pics). But I also note that the total WS has jumped up as well. Perhaps due to the increased size of the NGEN images?

So I would think that I need to take this into account and I'm actually a couple MB worse off.

But then I also understand that since JIT is not occurring I am saving some space there. The JIT I believe will show up under private data.

I calculate this as: - [Δ Image ShareableWS] + ([Δ Image PrivateWS] - [ΔPrivate Data Total WS])

Using the figures below:

  • 56.3 + (-58.3 - -6.8) = saving of 4.8MB (per subsequent process)

So I guess the question is - am I doing this right? Is there anything I'm missing or failing to take into account here?

BEFORE NGEN

Before NGEN

AFTER NGEN

After NGEN

Was it helpful?

Solution

I disagree with your supposition that you're worse off due to the total WS going up from 212 to 263. The reason is that the bulk of that increase in your total is coming from the Shareable block, and you only pay the memory cost for that shareable block once.

So it really depends how many sessions/instances you have running of your app, as that once off 56MB is effectively shared between all sessions.

So the trade off goes like this:

Per session saving from Private WS = 86.3 - 81.9 = 4.4MB (= S)

Per session increase from Shareable = 56 / num sessions (= I)

So you what you want is for S > I. Obviously for low session counts you are worse off, and for high session counts you are better off. So to find the point at which you are equivalent:

4.4 = 56 / num sessions

Gives: Num sessions = 13

So on average if you have more than 13 instances of your app running on a server then you are better off using NGEN.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top