ADO & Application scope

Results 1 to 4 of 4

Thread: ADO & Application scope

  1. #1
    Join Date
    Dec 1969

    Default ADO & Application scope

    Respected Sir,<BR>As we are developing a mega site for<BR>a swiss client,we need to manage the traffic problems.<BR>We are instanciating the connection object ADO in global.asa as below.In your article you have written that it is not a good approach.But we have to think about thousand of users so we can&#039;t let the component<BR>instantiate n no of times for n concurrent users.<BR>IT WILL DEFINATELY TAKE MORE RESOURECES.<BR>So should continue with code below in global.asa or<BR>will have to use MTS ?<BR><BR>---------------------------------------------<BR>&#060;SCRIPT LANGUAGE=VBScript RUNAT=Server&#062;<BR>sub Application_OnStart <BR>Application.Lock<BR>DBLogin="DSN=mango;UID=man gouser;PWD=mango;DATABASE=mangopeople"<BR>set Application("con")=server.CreateObject("ADODB.Conn ection")<BR>Application("con").open DBLogin<BR>Application.UnLock<BR>end sub<BR>sub Application_OnEnd<BR>Application("DBLogin")=""<BR> end sub<BR>---------------------------------------------<BR>And then using the object in all pages as an<BR>application variable ? It works but what about an engineering approach ?<BR>Regards,<BR>Rushi Shroff,<BR>Tech Consultant,<BR>Infrastructure Leasing and Financial Services,<BR>India<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: ADO & Application scope

    I apologise in advance, because I have some harsh words for you. Unfortunately you need to hear them:<BR><BR>This is ABSOLUTELY the WORST POSSIBLE DESIGN for the application. The fact that you "have to think about thousand of users" is EXACTLY why you MUST follow the best practice approach of creating connections late and releasing them early. Yes, each request will take more resources but those resources will be managed much more efficiently.<BR><BR>The fact that you state that "IT WILL DEFINATELY TAKE MORE RESOURECES" clearly indicates that you do not understand the infrastructure you are working with or proper application design. The entire operating system is desinged to promote scalability, but you have to work with it. Caching a single connection at application scope completely defeats all the scalability features of COM/MTS/COM+/OLEDB. <BR><BR>If your site is taking so much traffic that your server can&#039;t handle it then you need to scale up the hardware. If you need really major scalability then you will need to move data access into a component tier, preferably hosted on a seperate component server.<BR><BR>My advice would be to go back to the start and learn how to build Windows DNA Applications properly - there are fundamental principles here which you seem completely unaware of. This is NOT like writing a desktop application! <BR><BR>Here are some useful articles:<BR><BR><BR><BR><BR>I hope your client isn&#039;t reading this.<BR><BR>Dunc

  3. #3
    Rob Guest

    Default RE: ADO & Application scope

    I hate to be rude as well but as a consultant I must also step in here.<BR><BR>You don&#039;t have THOUSANDS of users yet. And your approach is going to suck the life out of your app with a few users. Just write it. If you go up in thousands of users then move up in server resource. This managing connections in app variables yadda yadda yadda<BR>is rediculous and a result of paranoia. Open your connections and close your connections as quick as you can.<BR><BR>And if you EVER hit thousands of users then get more power.<BR><BR><BR>Rob

  4. #4
    RDM Guest

    Default RE: ADO & Application scope

    I&#039;ll be a little kinder than my counterparts but their concerns are right on the money. My only reason for replying is the comment you make about it being a performance problem recreating objects and connections. While it seems odd for normal COM developers, it is actually faster and takes less resources to create the objects, create the connection, process the task, close the connection, and destroy the objects with each database interaction (query/database update). It would be a good idea for you to create a little test app to confirm these findings. I think you&#039;ll be surprised that its faster!

Posting Permissions

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