473,769 Members | 7,558 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Object management : keep alive or dispose and rebuild

Hello,

I have built an object which does some jobs on a particular server.
There can have lots of this object running concurrently.
I want to know what is the best way to optimize my application:
- keep all those objects alive in memory without any timeout (the object is
built one time per user, then disposed when the user exits).
- as I can rebuild the object, I can build the object, execute the job once,
then dispose this object each time the user asks to run a method.

The first solution costs a lot of memory, but the application will be more
responsive (the object has not to be rebuilt).
The second one will cost less memory usage (if users doesn't stress the
server).

So my question is:
Is it better free memory as soon as possible, even if the server can have
stress period or is it better to keep these objects alive to increase the
performance ?
Will the second one slow the server dramatically during a stress period ?
Thanks in advance for your help.
Mar 17 '08 #1
1 2308
On Mon, 17 Mar 2008 04:40:02 -0700, Alphapage
<Al*******@disc ussions.microso ft.comwrote:
[...]
So my question is:
Is it better free memory as soon as possible, even if the server can have
stress period or is it better to keep these objects alive to increase the
performance ?
Will the second one slow the server dramatically during a stress period ?
It's impossible to answer the question without knowing more about your
exact situation. What areas of performance are the highest priority, how
do you expect users to use your server, what are the relative costs in
time and memory involved, what kind of hardware are you running on, which
version of Windows are you using, etc.?

Now, I'm not saying you should post the answers to all those questions
here. I'm just trying to point out that it's a fairly broad question and
this isn't really a great forum for answering that sort of thing.

Now, that said, I would say that in most situations if you are concerned
about responsiveness then the right thing to do is keep your objects
alive. You don't have to worry about idle clients consuming physical RAM
and thus interfering with responsiveness serving other clients, as Windows
will swap out to disk the memory that's not being used.

Obviously there may be a concern with respect to running out of memory
(consuming the virtual address space in the process being the most likely
concern), but IMHO that's better addressed by other means (e.g. switching
to 64-bit Windows if it's really that big of a problem). Unless your
server is serializing user access and guaranteeing that you are never
servicing more than some fixed number of users at a time, then your memory
requirement is determined by the total number of connected clients anyway,
whether or not you discard service objects when they aren't needed.

Pete
Mar 17 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
10904
by: Ben Dewey | last post by:
Project: ---------------------------- I am creating a HTTPS File Transfer App using ASP.NET and C#. I am utilizing ActiveDirectory and windows security to manage the permissions. Why reinvent the wheel, right? Everything so far is working well with the Active Directory. The problem I am having is with adding File Permissions to a directory. I am currently using some code courtesy of "Willy Denoyette "
1
4891
by: Viorel Ghilas | last post by:
Hi all I have a list of Componet objects and put them in Containner, after container is disposed then components doesn't disposed I write some code example Component c = new Component(); using(Container list = new Container()) { list.Add(c, "c");
1
1865
by: cppdev | last post by:
Hello, After reading a few articles, http://blogs.gotdotnet.com/cbrumme/PermaLink.aspx/e55664b4-6471-48b9-b360-f0fa27ab6cc0 http://blogs.gotdotnet.com/anathan/commentview.aspx/8ec0b7b2-6290-4500-a8c7-1b6c677214cb i have the following question: __gc class C {
5
3009
by: david.kao | last post by:
Hi All: I am creating a COM+ Pool object in C#. I set up the following attributes: JIT (true),Pool size; and at the end of each public method I called ContextUtil.DeactivateOnReturn=true to set DONE flag; and also I override CanBeBooled method to true. In my calling program in C#, first of all I am using NEW to create a object, then I call the method then I call dispose.
5
2518
by: Michael Moreno | last post by:
Hello, In a class I have this code: public object Obj; If Obj is a COM object I would like to call in the Dispose() method the following code: System.Runtime.InteropServices.Marshal.ReleaseComObject(Obj);
16
2900
by: anonymous.user0 | last post by:
The way I understand it, if I have an object Listener that has registered as a listener for some event Event that's produced by an object Emitter, as long as Emitter is still allocated Listener will stay alive. Is this correct? If this is correct, I've got a problem. Let's say I've got an object Customer that has an PurchaseList (Collection) of Purchase objects. Now, these Purchase objects were pulled from a datasource Datasource. The...
4
4124
by: pgmanno | last post by:
Hello all, Here is my question. I have an AxWebBrowser (hereafter refered to as "Browser") control framed in a smart client. The smart client requires logon, and the web app that the Browser is pointing to requires logon and is using Forms Authentication. I have set up a web service so that when the user logs on to the smart client, s/he can also log on to the website (basically, the username/password is passed up, auth ticket set...
1
8370
by: Don | last post by:
I'm getting the following exception displayed in the task list at design time for my project: "Code generation for property 'Controls' failed. Error was: 'Object reference not set to an instance of an object.'" I've traced the problem to a custom control I created that inherits from Inherits System.Windows.Forms.TextBox. In this custom control, I have two constructors. I'm not sure why I created the second constructor -- it was so...
20
13327
by: Justin Rich | last post by:
so im trying to be good and not leave anything hanging open but i guess ive seen a variety of ways to kill objects.. is there like a recommended way? basically im looking for best practices for handling object destruction. Thanks Justin
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10048
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9996
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7410
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6674
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3963
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.