Raise cache tag purge limit

Created on 17 June 2019, about 6 years ago
Updated 2 May 2023, over 2 years ago

I'm not actually sure where to put this issue, but I believe Cloudflare's API now supports up to 30,000 purge calls per day, even for tags. If so, this means we can raise the limits on this module. See this PR: https://github.com/d8-contrib-modules/cloudflarephpsdk/pull/32

✨ Feature request
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States rbayliss

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡ΏNew Zealand RoSk0 Wellington

    According to the Purge using cache-tags from docs this is now 250k:

    You can purge up to 30 cache-tags per API call and up to 250,000 cache-tags per a 24-hour period.

    Currently limit on the module side is 30k.

  • πŸ‡ΊπŸ‡ΈUnited States charginghawk

    Upgrading to major just because hitting an artificially low limit is a real annoyance.

  • Status changed to Needs review over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States charginghawk
  • Status changed to Needs work 3 months ago
  • πŸ‡ΊπŸ‡ΈUnited States charginghawk

    Cloudflare now uses "Token bucket rate limiting" instead of the daily limit.

    https://developers.cloudflare.com/cache/how-to/purge-cache/#availability...

    https://github.com/cloudflare/cloudflare-docs/commit/f6d88cd4286581d3fa0...

    Not entirely sure what that means, but I think we can do away with the cache tag purge limit entirely. It looks like requests over the limit get queued, and the limit varies by plan anyway instead of being one-size-fits-all.

  • πŸ‡³πŸ‡ΏNew Zealand ericgsmith

    From the docs:

    If the bucket is empty, further requests must wait until new tokens are added. This system maintains fair usage while allowing occasional bursts within the bucket's capacity.

    So you are responsible for retrying the last request - Cloudflare is not queuing them.

    Their blog had a good example:

    For example, a free user starts with a bucket size of 25 requests and a refill rate of 5 requests per minute (one request per 12 seconds). If the user were to send 26 requests all at once, the first 25 would be processed, but the last request would be rate limited. They would need to wait 12 seconds and retry their last request for it to succeed.

    Each of those requests being a maximum of 100 tags (which I will open a separate issue for since the module currently limits to 30).

    The limits are so varied too between plans - that I think it will be pretty complicated to implement a check for this. That said - its not a limit on number of cache tags anymore - so I think DailyTagPurgeLimitCheck can be removed completely.

    Its then a question of if the module needs to implement a BucketSizeCheck of some kind.

    Something along the line of a BucketSize counter which
    - starts at the default size (e.g. 25)
    - decreases by 1 for each request
    - increases by 1 every X seconds until it hits the default size again

Production build 0.71.5 2024