RFR: 1731: Improve RestRequestCache rate limiter

Erik Joelsson erikj at openjdk.org
Tue Jan 3 18:19:16 UTC 2023


In the RestRequestCache, we are trying to limit non GET calls for a specific host and user to one call per second (and all calls, including GET, for a specific host and user, need to be serialized). This throttling is based on recommendations from GitHub (https://docs.github.com/en/rest/guides/best-practices-for-integrators?apiVersion=2022-11-28#dealing-with-abuse-rate-limits). The current implementation isn't really doing that however. Calls are serialized, but depending on timing, we can definitely send more than one non GET call per second, at least in bursts.

This patch tries to rework this, using two locks. During high contention, it's possible that this new implementation will be less favorable to non GET calls than the current implementation, but I'm pretty sure we will at least adhere to the recommendation of performing at most one non-GET call per second. See bug for breakdown of locking order.

-------------

Commit messages:
 - SKARA-1731

Changes: https://git.openjdk.org/skara/pull/1453/files
 Webrev: https://webrevs.openjdk.org/?repo=skara&pr=1453&range=00
  Issue: https://bugs.openjdk.org/browse/SKARA-1731
  Stats: 32 lines in 1 file changed: 12 ins; 10 del; 10 mod
  Patch: https://git.openjdk.org/skara/pull/1453.diff
  Fetch: git fetch https://git.openjdk.org/skara pull/1453/head:pull/1453

PR: https://git.openjdk.org/skara/pull/1453


More information about the skara-dev mailing list