Jump to content

Worker process does not release RAM after sessions complete


Wicket

Recommended Posts

Hi All,

 

I would appreciate any help/tips/guidance

 

Bit of a long one, as I have tried to be as detailed as I can - but please stay with it!

 

My setup:

 

Delphi Version  - 10.2 Tokyo

UniGUI version - 1.0.0.1425

Data Access – UniDAC

DBMS – MS SQL Server

Deployment – ISAPI dll, IIS 8 (settings exactly match the deployment guide)

Number of Users –  ~100-120 concurrent (Stress test)

Architecture – Compiled to 64-bit -  I use one application data module per software module (I have 5), I use CreateOnDemand = True, and Free the data module when the module is closed.

I also use EnableSynchronousOperations, and TerminateOnBrowserClose

------------------------------------------------------------------------------------------------------------------------------

Ok, so I have an application that is nearing the end of the first phase of work –  which contains all functionality for the agreed minimal viable product.

On the surface everything looks great and everything is working as far as I can see.

 

Today I tasked myself with doing some stress tests and looking at memory to make sure everything was stable, before putting the whole app through test.

 

Which leads me to some questions –

 

A single user idles at ~8 mb – once the application is logged on)

Upon observing task manager, I noticed the "w3wp.exe" IIS Worker Process remains running in the task list, even after all of the sessions have ended – I guess this is because the deployment guide says to turns off Application pool recycling.

 

The issue I have here is that while all 100 users are connected my RAM is ~300 mb – once they all come off this drops to ~220mb – and the "w3wp.exe"  worker process memory usage stays at this indefinitely – and I am stumped to as why this might be the case?

 

I would of thought once all sessions had terminate this would at least drop in RAM usage – I understand the "w3wp.exe"  worker process will stay active until recycled, but the deployment guide said to turn off auto/timed/etc recycling – as this could affect the stateful nature of sessions.

 

I get the same affect with using less users, but obviously the RAM usage is much lower, so its less noticeable.

 

I do not get any errors on the stress test, and keep it really simple – log in to the application and open all modules, and scroll through some master detail relationships, to cause the app to do some work.

 

With all this in mind, what is the correct solution to make sure my server doesn’t run out of RAM without constant maintenance and recycling the application pool manually?

 

Am I missing something, or am I doing something wrong?

 

Thanks, Dan

Link to comment
Share on other sites

In my opinion (first suspect) : EnableSynchronousOperations = True.

 

This consume much server ressources. Instead use classical callbacks (synchronous = False : the best practice, by default).

Best regards.

Edited:

Can you do the same test StressTool, without opening forms (just from MainForm, you run somme long transactions....)

Link to comment
Share on other sites

Hi Pickya,

 

Yes - I have ReportMemoryLeaksOnShutdown := true; (This was my first thought too)

 

Obviously, this only works for VCL - so when I run locally using the standalone server it is active, rather than in my production environment.

 

I do not get any memory leak errors when running standalone vcl server.

Link to comment
Share on other sites

you can compile your project in debug use it normally, after a long use knock down the server, then if you have memory leak will appear.

 

I even have a case like a few users, the system starts with 28mb memory, after a long use between reports, registers, the system gets a 35mb memory even closing the sessions does not return for 28mb.

Link to comment
Share on other sites

Ok I will try your suggestions, thanks for the information.

 

I might be worrying about nothing, the fact is I need to get it running in a production environment to really see if I have an issue. The issue only came to light when I performed the stress test with 100-200 users.

 

What made me worry was that I expected the memory usage of the worker process to reduce a lot more when all sessions had ended - the memory does lower, but only by about half. And of course the worker process is still in the task list.

 

Do you manually recycle your application pools? - I think I will have a scheduled task to perform this at midnight - I can guarantee no user will using the system then, and this will mitigate against memory usage causing the server to fall over.

"c:\Windows\system32\inetsrv\appcmd.exe recycle apppool "NameOfTheAppPool"" 

 

Further testing needed - I will report back my findings.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...