add retry when a request fails; print avg req duration

- retry MAXRETRIES times (5 by default) when a request fails
  for whatever reason. fail after some attempts
- print the avg duration of the last 10 requests in the debug print