1

I want this to be more of a discussion than anything.

So I have a website at www.utopiapimp.com. Right now it gets over 1 mil page views a day. There is a ton of dynamic data on this site that is always changing. Think "live stock ticker" but for a online web game. I've run into a deep snag.

I load a few static items from the db when the web app starts, but after that each time a user logs in, I make a out 15 db calls for that user and stuff that entire object into cache from those 15 db calls. On my server monitor I can see my 4 gbs of ram slowely inch up to only 2 gbs. Then something happens and I don't know what.

The 1 core CPU VPS ,starts sitting at 25% forever. Sometimes the processing spikes to well over 50%. But after about 20 mins the 2gbs or ram drops suddenly down to about 400 mgs never to recover.

I can repeat this over and over again. I don't know what is causing this but the meticulous side of me scanned the website and code over hard and found no real hang ups. I began to think maybe I access the cache and store too many things in cache but I truly haven't come to a conclusion.

So after hearing that scenario, can anyone suggest something I may be missing? Maybe the application crashes? And it struggles to restart with the amount of hits it receives and just keeps crashing?

Im pretty hung up on this issue and cant seem to find a solution.

Maybe upgrading to a better vps might work, but i don't want to upgrade nearly to find the same problem there.

Any help pr suggestions would be brilliant because I've been struggling over this for the past week and my users are really hammering for a solution.

EDIT

Ive contacted my hosting company and waiting for a response. Any other suggestions or ideas would be greatly appreciated...

thanks so much!

SpoiledTechie.com
  • 10,515
  • 23
  • 77
  • 100
  • Just a guess, but have you considered if other VPS on the same physical server may be using up the available RAM? We've had a scenario that sounded somewhat similar to your case, where the server RAM would get blocked/used by some unknown proces. We complained to our hosting provider, and they did "something" to fix it. I know this isn't much help, but it's something I'd investigate as well... – Jakob Gade Nov 21 '11 at 06:41
  • would that cause the application to then recycle? I guess it would because the ram gets pushed and cleared. – SpoiledTechie.com Nov 21 '11 at 13:48
  • 1
    @scott what data access techniques are you using? If you are using DataSets and DataTables, or large in memory XML documents or anything that creates large byte[] arrays you can create surges of memory use that trigger recycles or OOM errors. I'd also check to see what you are putting into Session. Putting stuff into Session is more dangerous than Cache because cache will clear on memory pressure, Session can stay around a long time regardless to memory pressure. – MatthewMartin Nov 21 '11 at 16:18
  • @Matt Sessions can be more dangerous? Do you have something I could read on that? I am story Lists<> of objects along with Linq Objects. by definition, the objects are pretty big. I don't have a size of the average object, but they are bigger than just the average ints and variables. Nothing is XML. All Lists and Variables inside an object. – SpoiledTechie.com Nov 21 '11 at 16:46
  • 1
    @Scott Dangerous only in the sense that Session uses memory and memory is scarce in a web app under load. A session lives as long as the session timeout-- regardless to how much memory is available. This is why often people shift to SqlSession when the site grows. (Although that often requires changing the app to make sure everything you put into session is serializable). SqlSession can support many more hits before you run into memory constraints. (And in ASP.NET memory pressure shows up as recycles, not necessary as the computer hit 100% mem usage. – MatthewMartin Nov 21 '11 at 17:34
  • @Matt, I have never heard of that session state. Thank you for that little lesson on ASP.NET, but I also don't actually have admin access to the SqlServer so I think im sort of screwed there. I wonder if you ever dealt with State Server Mode? If you have, does it compare well? btw, Thank you for helping me. – SpoiledTechie.com Nov 21 '11 at 18:39
  • 1
    The 3rd option uses a windows service separate from IIS to store state. That one is aimed at web farm scenarios where requests may go to any machine, but the request can still find the session on a single machine. It might help, since the State Server is running outside of IIS and thus won't be drawing on the same pool of resources. I can't say I have any production experience with it tho. – MatthewMartin Nov 21 '11 at 18:43

1 Answers1

1

The section processmodel in machine.config contains a parameter memoryLimit which is normally at 60% of the available memory. Maybe that causes a reset of your application pool. Try to increase the amount to see wether this causes the reset.

<processModel ...
          memoryLimit="60"
/>

Another possibility is that .NET gets short of memory and clears the cache. I used to create an admin page where I can have a look which objects are currently stored in the Cache.

EDIT: In case you store huge data in the session, the required memory increases with every user. After sesssion timeout, the required memory will be reduced. You should always try to avoid storing too much data in the session.

slfan
  • 8,950
  • 115
  • 65
  • 78