pierky / arouteserver

A tool to automatically build (and test) feature-rich configurations for BGP route servers.
https://arouteserver.readthedocs.org/
GNU General Public License v3.0
284 stars 46 forks source link

PeeringDB anonymous API throttling #107

Closed pierky closed 2 years ago

pierky commented 2 years ago

ARouteServer may trigger the PeeringDB anonymous API throttling mechanism.

PeeringDB API keys: https://docs.peeringdb.com/howto/api_keys/

pierky commented 2 years ago

The (optional) environment variable SECRET_PEERINGDB_API_KEY can now be used to set the API key to be used for PeeringDB API queries. This should mitigate the effects of the anonymous API throttling mechanism.

The CI/CD pipeline is running for 1.15.1-alpha1: once it will be completed, it will be possible to install and test out the pre-release following these instructions.

The new env var will be shipped as part of 1.15.1.

pierky commented 2 years ago

Other options:

ccaputo commented 2 years ago
  • implement a retry strategy with an incremental back-off time in response to 426;

429

grizz commented 2 years ago

I'd be happy to help with that one! It would also be a good excuse to make the client use a local cache.

pierky commented 2 years ago

A retry-on-failure with back-off has been added, and also a way to pass the API key using a local file at a well-known path.

The CI/CD pipeline is running for 1.15.1-alpha2, which includes these changes: once it will be completed, it will be possible to install and test out the pre-release following these instructions.

pierky commented 2 years ago

v1.15.1 is out, with a way to set the API key. Using authenticated API queries should reduce the impact of rate limiting.

This issue will remain opened until I’ll check how to implement bulk queries, which should lower the number of interactions between ARouteServer and the PeeringDB API.

ccaputo commented 2 years ago

If not using peeringdb-py, also needed:

ccaputo commented 2 years ago

Another thing that would be great:

pierky commented 2 years ago

I pushed some commits here to implement the bulk queries (150 ASNs being queried at once to get IRR info and max-prefix limits) and also to add the user-agent header.

The CI/CD pipeline is running for 1.16.0-alpha1, which includes these changes: once it will be completed, it will be possible to install and test out the pre-release following these instructions.

pierky commented 2 years ago

v1.16.0 is out with the improvements mentioned above.

I’ll file another ticket to analyze a potential integration with peeringdb-py, or to check whether it’s possible to add support for it.