NetTalk Central

Author Topic: Troubleshooting Memory Leaks  (Read 4681 times)

debraballenger

  • Newbie
  • *
  • Posts: 49
    • View Profile
    • Email
Troubleshooting Memory Leaks
« on: September 11, 2013, 06:50:08 PM »
Hi All

In my NTWS (7.22 C8) application I am having problems with my memory utilization growing to the point of it reaching the 3 GB limit over the course of the day.  The application runs against an sql backend with the business logic stored in the backend.  I allow file uploads (generally pictures) and I have the upload size set to 10 mb. 

What is the best way to troubleshoot where the memory is going and not being released?  Any pointers are really appreciated.

Thanks
Debra

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: Troubleshooting Memory Leaks
« Reply #1 on: September 11, 2013, 09:17:29 PM »
Hi Debra,

Are you using the SV In Memory driver?

I believe that can cause the task manager to report incorrectly as to the size of the system (as can queues perhaps, not sure, was a long time ago I read about it).

OR, it could just be that you have memory files that are growing by that much throughout the day.
Cheers,

Stu Andrews

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: Troubleshooting Memory Leaks
« Reply #2 on: September 11, 2013, 10:15:10 PM »
Hi Debra,

there are a couple of possible reasons;

a) the number of sessions is growing and growing. This might happen if (for example) the server was being queried by a program (one that didn't pass the session cookie). If your session timeout is really long then these "dead sessions" will accumulate and consume some ram. but it would take a lot to fill up gigs of ram.

b) the number of threads active at a time is growing. This is possible if you have "long running" threads, like say reports or processes. Indeed if you manage to do something that means a specific thread never actually ends then obviously that will eventually be a problem. It could also happen if you have a large number of very active users. You'll see ram usage grow with active threads, but you should also see it drop as the thread number drops.

c) incoming Posts consume Ram as they are coming in, but they don't start a thread until the post is complete. Typically the thread then only lasts for a very short time as the Post is dealt with (and perhaps a file is saved etc.) You've done the right thing by putting a limit on the post size, that at least stops one client sending you a 2 gig file.

d) If you are using the In-Memory driver then you need to make sure data is removed from it when a session ends. There is a method in the WebHandler designed for this called .NotifyDeleteSession. Inside this method you can access p_web.SessionId, but not other session variables. What you do need to do here is remove any items in the memory table which may be related to that session. Failure to do this will result in the memory table growing, and consuming ever more ram.

The Performance Tab on your web server window is your friend here. It allows you to monitor number of sessions, number of threads, number of session variables and so on. This can give you lots of clues as to where the problem might be.

Cheers
Bruce

debraballenger

  • Newbie
  • *
  • Posts: 49
    • View Profile
    • Email
Re: Troubleshooting Memory Leaks
« Reply #3 on: September 15, 2013, 02:40:51 PM »
Thanks Stu and Bruce.  That helped!

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: Troubleshooting Memory Leaks
« Reply #4 on: September 16, 2013, 05:10:49 AM »
which one was it?

debraballenger

  • Newbie
  • *
  • Posts: 49
    • View Profile
    • Email
Re: Troubleshooting Memory Leaks
« Reply #5 on: September 17, 2013, 01:15:15 PM »
It was a combination of A and D that you listed in your post. 


Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: Troubleshooting Memory Leaks
« Reply #6 on: September 17, 2013, 06:13:17 PM »
Thanks for the feedback Debra.