AnyEvent-FastPing

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

	- fix a bug in the checksumming algorithm.

2.01  Sun Feb  6 01:23:25 CET 2011
	- add_hosts now allows mixed ipv4 and ipv6 addresses.
	- netbsd and solaris lack PTHREAD_STACK_MIN. sigh.

2.0   Wed Feb  2 21:20:11 CET 2011
	- use completely different object-oriented API. more complex, but
          also much more flexible.
        - support host lists in addition to ranges.
        - support per-pinger receive callbacks, no more global callback stuff.
	- no longer embed floating point values in packet, to avoid relying
          on isnormal.
        - use slightly faster ipv4 checksumming function.
        - better cope with high overload conditions by using exponential backoff.
        - add missing - sigh - common::sense dependency.

1.15  Sun Jan 30 00:55:10 CET 2011
	- famous last words: final 1.x API release.
        - bin/fastping didn't support ipv4 anymore, due to a thinko :/.

FastPing.pm  view on Meta::CPAN

AnyEvent::FastPing object 2. configure the address lists and ranges to
ping, also configure an idle callback and optionally a receive callback
3. C<start> the pinger.

When the pinger has finished pinging all the configured addresses it will
call the idle callback.

The pinging process works like this: every range has a minimum interval
between sends, which is used to limit the rate at which hosts in that
range are being pinged. Distinct ranges are independent of each other,
which is why there is a per-pinger "global" minimum interval as well.

The pinger sends pings as fats as possible, while both obeying the pinger
rate limit as well as range limits.

When a range is exhausted, it is removed. When all ranges are exhausted,
the pinger waits another C<max_rtt> seconds and then exits, causing the
idle callback to trigger.

Performance: On my 2 GHz Opteron system with a pretty average nvidia
gigabit network card I can ping around 60k to 200k addresses per second,

FastPing.xs  view on Meta::CPAN

  if (self->next < now)
    self->next = now;

  while (self->rangecnt)
    {
      RANGE *range = self->ranges [0];

      // ranges [0] is always the next range to ping
      tstamp wait = range->next - now;

      // compare with the global frequency limit
      {
        tstamp diff = self->next - now;

        if (wait < diff)
          wait = diff; // global rate limit overrides
        else
          self->next = range->next; // fast forward
      }

      if (wait > 0.)
        ssleep (wait);

      now = NOW ();

      ts_to_pkt (&pkt, now);

README  view on Meta::CPAN

    AnyEvent::FastPing object 2. configure the address lists and ranges to
    ping, also configure an idle callback and optionally a receive callback
    3. "start" the pinger.

    When the pinger has finished pinging all the configured addresses it
    will call the idle callback.

    The pinging process works like this: every range has a minimum interval
    between sends, which is used to limit the rate at which hosts in that
    range are being pinged. Distinct ranges are independent of each other,
    which is why there is a per-pinger "global" minimum interval as well.

    The pinger sends pings as fats as possible, while both obeying the
    pinger rate limit as well as range limits.

    When a range is exhausted, it is removed. When all ranges are exhausted,
    the pinger waits another "max_rtt" seconds and then exits, causing the
    idle callback to trigger.

    Performance: On my 2 GHz Opteron system with a pretty average nvidia
    gigabit network card I can ping around 60k to 200k addresses per second,



( run in 0.615 second using v1.01-cache-2.11-cpan-49f99fa48dc )