hcurrie
11/7/2008 5:02:00 PM
>
> ==================================================
> I don't understand why you say I should only use normal priority.
> ==================================================
>
> It seems is the only way to meet your requirement as you don't want to
> remove all the items with the Normal priority. When the server is about to
> exceed the memory limit it'll begin to drop cache items. Each time about
> 50% of the cache items will be dropped. If you have specified the
> priority,
> the items with low priority will be dropped first. Say you have 100,000
> items with AboveNormal priority and 100,000 items with Normal priority,
> all
> the 100,000 items with Normal priority will be removed the first time the
> server meets the memory limit. If then the memory pressure is still too
> high, 50,000 items with the AboveNormal priority will be dropped. The
> server continues doing this until the memory pressure is low.
This just confirms to me that it is a good idea to use different priorities.
If I give everything the same priority, I basically have no control over the
order in which things are removed (although presumably the cache will give
preference to items that have not been used often/recently).
I have some items that are easier to regenerate (less processing intensive,
or smaller in size) than others, so I am giving these a lower priority. This
means that the more difficult items to regenerate are less likely to be
removed from the cache.
You are right that I don't want it to remove *all* of the normal priority
items, but I would like it to remove these before starting on the higher
priority ones, and this seems to work OK. From your explanation it seems
that it isn't removing them all, just half of them, but this is still
undesirable.
>
> Above is the basic policy how the cache items are dropped.
OK. Thanks for the explanation. It is a big help to my understanding. I
would never have dreamed that it would decide to immediately drop 50% of the
cache items when it starts to near the limit. I would have thought that it
would try to just drop enough to bring it below the limit. Do you happen to
know if this is just 50% of the number of items, or if it drops a number of
items that take up 50% of the memory used? Also do you know if it is
possible to tweak some of these parameters, it would seem much more sensible
to me to drop say 5% or 10% rather than throwing out half of the items in
one go.
>
> ==================================================
> I am thinking about adding a long sliding expiration time to some of the
> items, which in normal operation will hopefully prevent the low memory
> condition from occurring very ofte
> ==================================================
>
> Setting the expiration time is a good idea and is recommended.
Unfortunately, this will mean that after a certain period of inactivity, the
cache will start removing items unnecessarily that are still valid, and this
will have an affect on the performance later when those items are needed
again. I'll just have to weigh this against the performance problems that
I'll encounter if I allow the cache to fill up and it then suddenly drop
half of the items all in one go.
Thanks for your help.
It is very much appreciated.
Phil.