Optimized ping with threads in ruby, possible?
I am using ruby 1.8.7 and I cannot upgrade to 1.9+ anytime soon.
开发者_JAVA技巧I understand that ruby has green threads, and anything cpu based does not gain much by way of multithreading.
However, I was trying a multithreaded ping in ruby, as in my script will try to ping N machines in the network -- in the time a machine replies back there's enough time to create a new thread and initiate connection with another host. However what I see is that multithreading has actually worsened performance.
Any suggestions to do an optimized ping with threads in ruby?
You should use EventMachine with an ICMP implementation. The author of icmp4em also provides two examples how to use all this stuff.
精彩评论