开发者

asp.net mvc 3 ram usage and caching output(varybycustom)

开发者 https://www.devze.com 2023-04-03 02:54 出处:网络
i have a problem with site that is a new project, ~500 unique visitors daily. Some of these visitors hit site in same time, im trying to tell 100 online visitors at the moment.

i have a problem with site that is a new project, ~500 unique visitors daily. Some of these visitors hit site in same time, im trying to tell 100 online visitors at the moment.

The usage of RAM of w3wp.exe starts with expected, when i looked the server status just a few hours later, RAM usage is over 500M.

So I decided to cache the output and improve performance. ( if you have any suggestion, advice for me about ram problem please let me know, im newbie at mvc 3 )

I added OutputCache Attribute to all the controllers i have and then i realize there is a issue. I use cookies to make multi-language the site and i have a section about logged user info. It have to un-cache and cache it when user logged in or out i think.

    public override string GetVaryByCustomString(HttpC开发者_如何转开发ontext context, string custom)
    {
        switch (custom)
        {
            case "UICulture":
                return context.Request.Cookies["CurrentUICulture"].Value.ToString();

            default:
                return "";
        }
    }

    and this controller's action.

    [OutputCache(Duration = 60, VaryByParam = "none", VaryByCustom="UICulture")]
    public ActionResult Uniques() {
          return View(ukList);
    }

This is the method i have used for overridding but its not working.


The .NET framework will take the amount of RAM it thinks is better to cache data and pages. The output caching probably wont do anything to the amount of RAM the application takes. If no other threads on your server is requesting RAM, .NET framework won't release it to the system as it is more performance wise when there is enough RAM on your machine.

You should not worry about this.

0

精彩评论

暂无评论...
验证码 换一张
取 消