Results 1 to 12 of 12

Thread: How many objects can be created simultaneously?

Hybrid View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2001
    Location
    oxford, UK
    Posts
    149

    Re: How many objects can be created simultaneously?

    OK I appreciate your help. Now the line that is causing the problem is trying to set an object:

    Set objSMSReceiver = ...

    I dont think the rest of the page is particularly relevant - 9 times out of 10 this works. I suspect that when this page is called simultaneously, or at very close intervals, the dll is still processing stuff, and only a limited number (or even 1) instance of this may be created at one time.

    I'm sorry if I'm not being very clear but I really odnt know how to explain better. I really need to try and understand if this is the case or not and how to improve matters.

    Is this anything to do with 'threading'?

  2. #2
    Addicted Member
    Join Date
    Nov 2006
    Posts
    132

    Re: How many objects can be created simultaneously?

    Quote Originally Posted by kester_holmes
    OK I appreciate your help. Now the line that is causing the problem is trying to set an object:

    Set objSMSReceiver = ...

    I dont think the rest of the page is particularly relevant - 9 times out of 10 this works. I suspect that when this page is called simultaneously, or at very close intervals, the dll is still processing stuff, and only a limited number (or even 1) instance of this may be created at one time.

    I'm sorry if I'm not being very clear but I really odnt know how to explain better. I really need to try and understand if this is the case or not and how to improve matters.

    Is this anything to do with 'threading'?
    Okay - lets see if we can figure this out.

    Questions:
    1: what is the instancing property of your clsMessageHandler set to?

    2: Are you running your code in a COM+ package? and if not, why not?


    3: Are you doing anything in the clsMessageHandler Class_Initialize event?

    4: Are there any resources used in clsMessageHandler methods that are not being properly closed or discarded after use?

    5: How many concurrent users need to be hitting the page before the problem shows up?

    6: As you intimated, what is the threading model selected in the project properties > general tab?

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2001
    Location
    oxford, UK
    Posts
    149

    Re: How many objects can be created simultaneously?

    Excellent! i suspect these are exatly the type of things (about which i have no experiance!) that I need to consider.

    1. Instancing is set to 5 - Multiuse
    2. no idea what COM+ is. Should I be using this? What would I need installed on server to use this?
    3. Yes I am doing stuff in the Initialise event:

    'Initialise database connection
    Set noDB = New clsDatabase

    In turn clsDatabase.Initialize attempts to open a connection to the remote database for subsequent database transactions

    4. Its possible that resources are not being discarded. By this you just mean ensureing that all objects are set = Nothing, right? I will check.

    5. No idea how many concuirrent. Impossible to count and also to know whether the dll is still running. Probably no more than 10-ish. I log each request to the page and sometimes get up to 10 in the same 1-2 seconds (as I said the dll can take 20-30 secs to complete)

    6. Single threaded

    thanks for these suggestions,
    it is likely that the load on server will increase dramatically soon so this will become urgent!

  4. #4
    Addicted Member
    Join Date
    Nov 2006
    Posts
    132

    Re: How many objects can be created simultaneously?

    Quote Originally Posted by kester_holmes
    Excellent! i suspect these are exatly the type of things (about which i have no experiance!) that I need to consider.

    1. Instancing is set to 5 - Multiuse
    Multiuse is the "default" when you create a class in a dll. And it is probably the right choice for your project
    Quote Originally Posted by kester_holmes
    2. no idea what COM+ is. Should I be using this? What would I need installed on server to use this?
    You need to read up on this. It is very likely that when you start scaling your site up for more users you are going to want your code to be running in COM+. What server are you using? The COM+ environment already exsists on your server, and you will work with it via the Administrative Tools > Component Services snap-in. We can go into this later as we delve into this - this is a big subject and is complex.
    Quote Originally Posted by kester_holmes
    3. Yes I am doing stuff in the Initialise event:

    'Initialise database connection
    Set noDB = New clsDatabase

    In turn clsDatabase.Initialize attempts to open a connection to the remote database for subsequent database transactions?
    This is what I was suspecting - I suggest you add some error handling code in here to see if this is where the error is accually occuring. Do you have a comprehensive error handling methodology in place? If not, that is also something you need to work on right away. It is possible your db connections are used up, and tons of other things as well. It would be very useful for you to determine if there are actually problems happening in here. Like I mentioned earlier, the error you are getting is caused in a few, specific ways, and the line of code you indicated in your first post does not seem likely to directly cause the error. Of course, I could be wrong and it wouldn't be the first time. Also... Is clsDatabase in the same dll as clsMessageHandler
    Quote Originally Posted by kester_holmes
    4. Its possible that resources are not being discarded. By this you just mean ensureing that all objects are set = Nothing, right? I will check.?
    Yes, all objects ESPECAILLY DB CONNECTIONS and file resources have to be handled well. However, this is more than just setting to nothing - it is also properly closing connections and files, for example. You see, any resource that isn't being directly managed by your code is outside of the context of your running code - and therefore you need to instruct it to "dispose" of itself at the proper time - otherwise it just hangs out there, and you get "memory leaks" and out of resources type errors. You also need to pay attention to how you dispose of these things when errors occur - you can't just leave the code with the error without first determining the state of these "outside" resources and properly dealing with them
    Quote Originally Posted by kester_holmes
    5. No idea how many concuirrent. Impossible to count and also to know whether the dll is still running. Probably no more than 10-ish. I log each request to the page and sometimes get up to 10 in the same 1-2 seconds (as I said the dll can take 20-30 secs to complete)?
    So one BIG question - 20 to 30 seconds? That is a very long time to do part of the processing for a page hit. Besides everything else, it will probably become very important to optimize this or you may never be able to scale.
    Quote Originally Posted by kester_holmes
    6. Single threaded?
    Ah. This could be a problem. I would experiment making this apartment threaded. Is there a reason you specifically chose single threaded?
    Quote Originally Posted by kester_holmes
    thanks for these suggestions,
    it is likely that the load on server will increase dramatically soon so this will become urgent!
    You'll want to buy some books so you have them on hand when time gets tight. Stuff on COM+, IIS use of COM+, etc. These will be very cheap becuase you can buy them used at all the typical used book sites, and almost NOBODY is developing new stuff in ASP, VB6, and COM anymore.

    Last but not least... any reason this can't be moved into something fresher such as .NET?
    Last edited by woodyz; Nov 28th, 2006 at 12:46 PM.

Posting Permissions

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



Click Here to Expand Forum to Full Width