-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Excessive API usage for Mozilla Firefox Add-ons (and deprecated API usage) #7584
Comments
In terms of the move from v3 to v4, thanks for flagging this to us. When it comes to the API usage: You've mentioned the trailing slash to cut down the number of requests that are just following a redirect. We haven't applied any custom cache durations for Mozilla Addons so we'll be using our standard cache durations, which are:
These are tuned to try and strike a reasonable balance between performance and up-to-date-ness. We aim to cache things that update frequently/unpredictably or show an exact value for shorter times and things that we expect to change less frequently or show a rounded/indicative value for longer. This helps our performance as well as reducing traffic on upstream APIs. Using your knowledge of the Mozilla Addons platform/API, is there anything there that strikes you as a mismatch. For example if you say "we only update our download counts once per day" or something, that would be a good reason for us to set a much higher duration on the downloads/user badges for Mozilla Addons specifically. |
Thanks for reaching out! We definitely understand the load Shields can swing to upstream services due to the popularity/utilization of our own platform, and strive to collaborate with those upstream providers whenever possible. It sounds like there's a couple easy things we can do on our end, but a few things worth sharing/discussing in more detail too.
Can't say I've ever heard of such a case before, but also an easy change on our end that we're happy to make in the short term as part of trying to tactically reduce the load For anyone interested in working on this: shields/services/amo/amo-base.js Line 24 in 5fa18e1
Thanks for letting us know. We're a very small, volunteer driven project that integrates with hundreds of upstream APIs/services, most of which us maintainers don't actively utilize ourselves. As such we're not really tied into the latest happenings with all those services and generally rely on the community and or those providers to let us know when something has/will change.
Lots to drill into here. Few questions for you:
|
Yes there will have been a couple of spikes over the last week where every request was a cache miss for a bit but given the longest we cache any Mozilla Addons badge for is 15 mins that probably didn't make a huge difference. If they're logging 2 requests on their end for each API call from us (1 for the redirect, 1 for the |
That was for the most recent month. We haven't drilled down into the specifics at this point.
We currently don't. We used to have an issue forcing us to be extremely permissive with rate limits of
We are able to handle the load, but from what we can see Shields.io is by far the biggest single consumer of our API outside of Mozilla, refreshing data that changes very little over and over quite often. Rather than giving you a target number of requests, I can answer the caching duration question from the other reply (assuming you fix the trailing slash issue):
This only changes one per day on our end, so I recommend following that and increasing to 86400 seconds.
This is updated asynchronously after each rating, but it's unlikely the averages would move that much over such a short period. I recommend increasing to 7200 seconds at least - possibly even 86400 to match the number of downloads/users.
This seems ok for now. FWIW, I've look briefly at ublock origin's badge on their GitHub page and the HTTP request for the image of its ratings has a caching duration of only 120 seconds - but I don't know if you're also caching things on the backend. |
Gotcha @chris48s. I thought it was happening intermittently throughout but looking back at the update you shared see I either remembered incorrectly or misunderstood in the first place |
That's excellent info @diox, thank you. We still have to consider the balance Chris mentioned between staleness/freshness and load, so I'm not sure if we'll necessarily max out all of these durations, but absolutely a lot of room to increase these and reduce the amount of traffic we send your way.
Correct, ratings/stars are a 120 seconds so I'd fully expect a ratings badge instance to have 120 seconds.
One thing that's not clear to me so I'll ask explicitly: are you suggesting Shields being your second biggest consumer is a problem in-and-of-itself, or is it simply a matter of volume of requests given the opportunities to reduce that volume? |
I'm hoping that reducing the volume of requests enough will make Shields less of an outlier so that we don't have to find out how much of a problem it actually is. Edit:
Given the popularity of ublock origin, I think bumping that much higher as I suggested above would greatly help with volume of requests. Like I said, it's unlikely for a rating to change dramatically in less than a few hours or even a day. |
Are you experiencing an issue with...
shields.io
🐞 Description
Hi,
The addons.mozilla.org team is looking at removing its v3 API as planned per deprecation announcement (We're in fact a bit late, we had announced we would shut it down on December 31st 2021).
When looking at this, we noticed a few problems with Shields.io:
Since we are going to shut down v3, you should start using v4 instead, perhaps adjusting your code depending on what this would break. Furthermore, we'd strongly urge you to find ways to avoid calling our API so much. Fixing that trailing slash issue will halve the number of requests, but please consider caching more aggressively. We can and will tweak rate limiting on our end, but not having to deal with the requests in the first place would be preferable.
🔗 Link to the badge
No response
💡 Possible Solution
No response
The text was updated successfully, but these errors were encountered: