[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Cheapest ping possible

Matthew Margolis

7/17/2005 1:26:00 PM

I have a client/server application that I am currently developing that
requires the server to ping all clients once every five minutes or so to
verify that the clients are up and active. The business server machine
we have at our disposal is a pretty low end linux box and there is
eventually going to be several thousand clients. How would all you
smart people out there reccomend I do the pinging? It needs to be very
easy on the server and as fast as it can be. If the company has 2000 of
their employees use the system then I have to ping 7 clients a second.
Threading of some sort seems like a must as nonconcurrent pinging seems
like it would take forever if there were lots of timeouts.
The only requirements are that I am able to get a ping time for each
client. It doesn't really matter what sort of data I am sending around.

I know about ruby ping
(http://www.ruby-doc.org/stdlib/libdoc/ping/rdoc/...). Has
anyone used this library for a lot of concurrent pings? Are there any
better solutions out there for what I need?


Thank you,
Matthew Margolis


4 Answers

Daniel Berger

7/17/2005 2:19:00 PM

0

Matthew Margolis wrote:
> I have a client/server application that I am currently developing that
> requires the server to ping all clients once every five minutes or so to
> verify that the clients are up and active. The business server machine
> we have at our disposal is a pretty low end linux box and there is
> eventually going to be several thousand clients. How would all you
> smart people out there reccomend I do the pinging? It needs to be very
> easy on the server and as fast as it can be. If the company has 2000 of
> their employees use the system then I have to ping 7 clients a second.
> Threading of some sort seems like a must as nonconcurrent pinging seems
> like it would take forever if there were lots of timeouts.
> The only requirements are that I am able to get a ping time for each
> client. It doesn't really matter what sort of data I am sending around.
>
> I know about ruby ping
> (http://www.ruby-doc.org/stdlib/libdoc/ping/rdoc/...). Has
> anyone used this library for a lot of concurrent pings? Are there any
> better solutions out there for what I need?
>
>
> Thank you,
> Matthew Margolis

I use net-ping, available on the RAA. I use that because, well, I
wrote it. :)

Yes, threads are probably the way to go:

require "net/ping"
include Net

threads = []
hosts.each{ |host_to_ping|
threads << Thread.new(host_to_ping){ |host|
ping_obj = PingTCP.new(host) # or UDP, or whatever you prefer
unless ping_obj.ping?
# Failed to ping 'host'
end
}
}

threads.each{ |t| t.join }

Regards,

Dan

Gary Wright

7/17/2005 2:58:00 PM

0


On Jul 17, 2005, at 9:26 AM, Matthew Margolis wrote:
> I have a client/server application that I am currently developing
> that requires the server to ping all clients once every five
> minutes or so to verify that the clients are up and active. The
> business server machine we have at our disposal is a pretty low end
> linux box and there is eventually going to be several thousand
> clients. How would all you smart people out there reccomend I do
> the pinging? It needs to be very easy on the server and as fast as
> it can be. If the company has 2000 of their employees use the
> system then I have to ping 7 clients a second. Threading of some
> sort seems like a must as nonconcurrent pinging seems like it would
> take forever if there were lots of timeouts.
> The only requirements are that I am able to get a ping time for
> each client. It doesn't really matter what sort of data I am
> sending around.
> I know about ruby ping (http://www.ruby-doc.org/stdlib/li...
> rdoc/index.html). Has anyone used this library for a lot of
> concurrent pings? Are there any better solutions out there for
> what I need?

Have you thought about using something like Nagios? http://
www.nagios.org/

This is an open source monitoring system. It will archive data, graph
availability, page people on escalation lists and so on.




Gary Wright



David Holroyd

7/17/2005 8:01:00 PM

0

On Sun, Jul 17, 2005 at 10:26:18PM +0900, Matthew Margolis wrote:
> Are there any better solutions out there for what I need?

Scanrand is supposed to be quick and lightweight,

http://www.doxpara.com/read.php/code/pa...


dave

--
http://david.holr...


Eric Hodel

7/17/2005 8:12:00 PM

0

On 17 Jul 2005, at 07:20, Daniel Berger wrote:

> Matthew Margolis wrote:
>
>> I know about ruby ping
>> (http://www.ruby-doc.org/stdlib/libdoc/ping/rdoc/...). Has
>> anyone used this library for a lot of concurrent pings? Are there
>> any
>> better solutions out there for what I need?
>
> I use net-ping, available on the RAA. I use that because, well, I
> wrote it. :)
>
> Yes, threads are probably the way to go:
>
> require "net/ping"
> include Net
>
> threads = []

threads = ThreadGroup.new

> hosts.each{ |host_to_ping|
> threads << Thread.new(host_to_ping){ |host|
threads.add Thread.new(host_to_ping){ |host|
> ping_obj = PingTCP.new(host) # or UDP, or whatever you prefer
> unless ping_obj.ping?
> # Failed to ping 'host'
> end
> }
> }
>
> threads.each{ |t| t.join }
threads.list.each { |t| t.join }

A ThreadGroup doesn't hang on to dead threads, so if a thread
finishes it will be garbage collected.

--
Eric Hodel - drbrain@segment7.net - http://se...
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04