|
-
Feb 9th, 2001, 09:20 AM
#1
Thread Starter
New Member
Help!! I need to figure out the easiest and quickest way to limit the number of running instances my component has going on the server. Right now, I have an ActiveX server (exe) running on the server and called via DCOM from the clients. The problem is that too many instances are running at once and flooding our server.
I am willing to redesign pieces of this but would prefer to still use DCOM to keep the process on the server. How can I limit the number of threads? Can MTS handle this for me? Looking at MTS, I can't figure out how it limits the number of threads. I only want to have like 5 running at a time and each client just grabs the next available in round robin format or whatever works best.
Thanks so much!
-
Feb 9th, 2001, 11:44 AM
#2
Fanatic Member
Threads
You can limit the number of threads of your ActiveX EXE by going into the project properties.
On the 'General' tab, select the 'Thread Pool' option and then select the maximum number of threads you wish to allow for your project.
N.B. This does not prevent more instances being created, it just means that further instances will be assigned to existing threads.
As for limiting the number of instances of your objects, this cannot be done within VB (Unless you want to limit your number of instances to one).
-
Feb 9th, 2001, 01:44 PM
#3
Thread Starter
New Member
Clarification -
If I change the number of threads to 5, what happens when the 6th client machine tries to get an instance? Does it throw an error back to the calling pgm, or does it wait for 1 to free up?
Is it possible to keep the 5 instances running and the clients just grab them when they instantiate a new instance?
This server exe does some intensive things on load and it would be great to leave them in memory on the server.
Thanks to all in advance!
-
Feb 9th, 2001, 02:08 PM
#4
Thread Starter
New Member
I tried it and....
it is not what I expected. I changed my activex server to use 2 for the thread pool. I installed on the server and had 3 clients instantiate. It creates 3 running instances of it on the server. What am I missing here?
Thanks!
-
Feb 12th, 2001, 03:43 AM
#5
Fanatic Member
threads and instances
Don't get them confused.
You can instantiate a class more than once in a single thread. If you have a limited thread pool, once all the threads are used up, An existing thread will be used and you will have two instances sharing the same thread.
Any global variables of the ActiveX EXE project will be shared between instances in the same thread.
Instances in different threads will have unique copies of the global variables.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|