COM vs Array/Session Variables

Results 1 to 6 of 6

Thread: COM vs Array/Session Variables

  1. #1
    Munish Guest

    Default COM vs Array/Session Variables

    &#062; I have a question to ask, we are developing a site using ASP, on each page<BR>&#062; of the site we are populating a dropdown list with about 70 odd records<BR>&#062; from an access database, now instead of opening the database on each page<BR>&#062; and retrieving the records we came up with 2 solutions one is that we<BR>&#062; write a custom COM component the other is that we can open the database on<BR>&#062; the first page that is accessed, put its contents into a session variable<BR>&#062; and then check all further pages for the session variable if it exists we<BR>&#062; just use the data else we can query the database again and set the session<BR>&#062; variable... my question is that which alternative seems faster to you..<BR>&#062; please do reply, I am from India....<BR>

  2. #2
    Juan Pablo Mattenet Guest

    Default RE: COM vs Array/Session Variables

    Munish,<BR> Ahhh Performance problems.. They are very dificult indeed.There are no general rules, I have tried the 2 approches, and still have no clear preference.<BR><BR>The questions you should ask are different:<BR> - How many clients are going to use the same server at the same time.<BR> - how often they are going to use this &#039component&#039?<BR> - Is the data subject to refresh or is somehow static?<BR><BR>For static info we use COM objects created with VB. But there are some limitations with this approach:<BR> - VB does not offer free thread mode, only appartment threads. In short it will only execute one request at the time.<BR> - Information should be read only (no change of state in the COM object)<BR> - Careffully release the DB Connection.<BR><BR>Benefit:<BR> -Fast execution.<BR> -Application wide Object.<BR>Contras:<BR> -Another language, and problems (Registration)<BR> -May produce serialized access because of threadding modes.<BR><BR>For move volatile info, we have used some javascript object, that store the information on a Application or Session Variables.<BR>Here the only rule is to store only strings and not com objects. <BR>Here the key thing is to use Application.lock/unlock to avoid interference from other task doing the same..<BR><BR>Benefits:<BR> - Same environment, faster development&#062;<BR> - If developped as Object, good encapsulation.<BR>Contras:<BR> - Less performant than VB or C++ COM Objects.<BR> - Appication/Session memory comsuption.<BR><BR>Hope it helps.<BR>JP<BR>Side track: The web has make the work smaller, you are in india, I&#039m in Belgium, but that is not special any more.

  3. #3
    Join Date
    Dec 1969

    Default RE: COM vs Array/Session Variables

    Do not use sessions. Just pretend sessions are evil, for the most part they are. I have seen big hosting server die after a few hours, only to find one web site was persisting objects in session level variables. <BR><BR>I write COMs for most of my database access, it is much faster, much cleaner, and you know exactly where the code is for all of your pages and this is where to make your fixes. <BR><BR> If you write a COM component to access your data store then you gain speed and maintainability. The main thing is that with COM you will create a connection get the records and spit them to the asp page, close your connections and the process is done.<BR> With sessions, unless you change your session expire time or explicitly have everyone log-out (so you can abandon the sessions) you will have sessions with all the data persisting for about 20 minutes after that user leaves your say its only 10k of memory. x 1000 users and you know have 10000k of memory held up for 20 minutes!!! and you need memory for operation and delivery...see the problems with sessions?<BR><BR>Hope that helps<BR><BR>Gary

  4. #4
    Darren Hoefgen Guest

    Default RE: COM vs Array/Session Variables

    What I have done in the past if the information was relatively static. Create the HTML in an include file. Then you don&#039t have to wait on the DB. And as long as they data doesn&#039t change often you can just edit the include file as needed for changes.<BR><BR>Darren

  5. #5
    Join Date
    Dec 1969

    Default RE: COM vs Array/Session Variables

    answer is simple:<BR>forget about COM objects!<BR>read the database and store a VB or Jscript string/array in the<BR>application space. only one copy. must restart app to change it, but it seems like that may not be a problem.

  6. #6 Guest

    Default RE: COM vs Array/Session Variables

    hi,<BR> it is better to have COM component and use it in MTS.when you create a component ,it will create an instance of the component and gives it to u and it will get disconnected after you set it to nothing.More Over it will avoid getting connected to database will save database resources.<BR><BR>if u use session variales the connection will always be there with the will not be effective.In general avoid using session and aplication variables when connecting to the database it is not recommended.try and do it.<BR><BR>Bye<BR>s.kishore<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts