Re: Pinging server using multithreading concept
by BrowserUk (Patriarch) on Nov 16, 2009 at 16:41 UTC
|
You are (almost certainly) running out of stack. See threads use threads ( 'stack_size' => 64*4096 };
Beyond that, using 500 threads where each does so little work every 60 seconds is a very memory intensive way to do things. Consider using the asynchronous 'syn' protocol of Net::Ping to efficiently ping your 500 hosts with minimal memory usage.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] |
Re: Pinging server using multithreading concept
by NetWallah (Canon) on Nov 16, 2009 at 17:26 UTC
|
| [reply] |
Re: Pinging server using multithreading concept
by roboticus (Chancellor) on Nov 16, 2009 at 15:50 UTC
|
nagivreddy93:
Try using asynchronous I/O rather than threads--i.e., fire off multiple pings, but rather than using a blocking read to get the response, you process responses asynchronously as they arrive. Using select on an array of sockets could do the trick, or maybe you'd prefer something like POE or IO::Lambda::Socket which handle much of the mechanics for you. (Note: I've used neither POE nor IO::Lambda::Socket, so I can't further comment on them.)
...roboticus | [reply] [d/l] |
|
|
I agree -- you should group your pings using select rather than use a 1-1 thread-ping model. Your thread failure is most likely due to memory issues. By default, threads are allocated a 16MB stack. 100 threads would use more than 1.6GB of memory. If you are really enamored of the thread-per-ping model, and you are using 5.10, you can set the stack size to something reasonable, like 128K (you probably don't need much if all you are doing is a simple ping).
fnord
| [reply] |
|
|
one process handling the 100 theads here..how to create the multiple process in linux and how to run the same program for each process... do you have any example please help me
| [reply] |
|
|
We are not used socket concept here just we have used for Net::Ping module to ping the server.
| [reply] |
Re: Pinging server using multithreading concept
by Utilitarian (Vicar) on Nov 16, 2009 at 15:36 UTC
|
Clearly it's an error on line 42
Though it may be your OS settings (Solaris, Linux, Windows?) max threads per process is settable at least two of the above. | [reply] |
Re: Pinging server using multithreading concept
by gmargo (Hermit) on Nov 16, 2009 at 15:47 UTC
|
| [reply] |
|
|
We have to monitor the server for every 1 minite... if the server is "up" every 5 min and if the server is "down" every 1 min we have pinged, that's way we have opened one thread for one serevr running that thread as continuoesly
| [reply] |