Login  
Search All Forums
Dart Home | PowerSNMP for .NET | Custom Development Reply | PowerSNMP for .NET Topics | Forums   
AuthorForum: PowerSNMP for .NET
Topic: Multi-threads problem when using Manager.Start(SlaveThreadStart,Object)
snmpuser

From: beijing
Posts: 21
Member Since: 06/11/09
posted July 8, 2009 4:06 AM

I hope to monitor agent variables on a manager via a poll-response mechanism.There are dozens of agents in the user's network. The user can configure the variables to monitor and the interval time per variable for each agent. I read the attached snmpPoll sample in which a new thread will be started for each poll-response item. I have two questions:
(1) How many threads can be started at most by the Manager.start(slaveThreadStart, Object)?
(2) I'm afraid that too many threads are started will affect the system performance. So, is there any other method to handle this situation?
Many thanks!
K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted July 8, 2009 12:13 PM

Hi,
1) There is no limit, other than the limits inherent to the system.
However, by default, it looks like there is a 250 thread limit (increased from 25 with .NET 2.0 SP1).
This number can be increased by setting a ThreadPool class property.

2) You do not have to create a new thread for every poll. 
You could start a limited number of threads, and then perform several polls on each one. 
Of course, this may affect performance, as each thread's polls would execute in series.

Hope it helps,
-ken
K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted July 9, 2009 4:21 PM

Hi,
I should have also mentioned that if you have a high latency on responses, you could also use the ManagerSocket Send and Receive methods instead of GetResponse.

This would allow you to dedicate just one thread to receiving responses, and as many as you choose for sending requests.
There would be a little more work involved to match requests to responses, though, since the two operations would be split up.
See the Send and Receive methods in the help documentation for example code.

-ken
snmpuser

From: beijing
Posts: 21
Member Since: 06/11/09
posted July 12, 2009 11:08 PM

Hi Ken, thanks for your help. I tried the two methods.will do a further performance testing and select one to develop my program. Thanks!
snmpuser

From: beijing
Posts: 21
Member Since: 06/11/09
posted July 14, 2009 5:15 AM

Sorry, I still have a question need to be clarified.

I hope to implement the following function:
if the configuration of polls is changed by the customer, for example, variables or internal time etc, SNMP Manager will re-start the polls using the changed configuration. I hope to stop the running polls(threads) before re-starting changed polls. In the sample snmpPoll, removing poll just stops the loop, but if the internal time is long, the thread will leave for a long time.
Is there any method to stop the thread directly?

Thanks!
K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted July 14, 2009 5:33 PM

Hi,
I tried this in the most recent version of the sample, and did not see much (if any) delay in cleanup of the thread.

I know that in this version, the PollItem is set to null when the poll is removed from the list, whereas it was not in previous versions.
Perhaps that makes a difference.

You can get the latest version using the Sample Downloads link accessible from the Start Menu.

Hope it helps,
-ken
snmpuser

From: beijing
Posts: 21
Member Since: 06/11/09
posted July 15, 2009 6:06 AM

Thanks Ken, I will do more testing for that. Thanks!
Reply | PowerSNMP for .NET Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX