Comments (7)
I assume the total bandwidth usage (in Zeit's dashboard) is already include cached responses.
Currently live badge are cached 3~4 minutes, static badge are cached 1 year, docs pages are cached 1 day, by Now CDN (Cloudflare). Plus 60 seconds cache on user's browser.
Here's scale rules for badgen.net, I never saw it spin up a second instance in sfo1 or bru1, so the server load should be fine (by now):
Scale
dc min max current
sfo1 1 2 1
bru1 1 2 1
Events
2018-08-13T15:01:12.811Z state INITIALIZING
2018-08-13T15:01:14.193Z build-start
2018-08-13T15:01:31.432Z build-complete
2018-08-13T15:01:31.490Z state READY
2018-08-13T15:01:33.000Z instance-start (sfo1)
2018-08-13T15:02:14.000Z instance-start (bru1)
2018-08-13T15:02:17.074Z scale-set
2018-08-13T15:02:41.688Z scale-set
2018-08-13T15:02:51.368Z scale-set
2018-08-13T15:02:59.716Z scale-set
But I'm not sure why response time rise from ~300ms to ~500ms recently 🤔
from badgen.net.
Now CDN is really a helpful & important cache layer for Badgen Service, glad we have it since the beginning. 💪
from badgen.net.
Currently live badge are cached 3~4 minutes, static badge are cached 1 year, docs pages are cached 1 day, by Now CDN (Cloudflare)
These are CDN cache by cloudflare. Cache status can be verified by:
curl 'https://badgen.net/npm/v/next' -sI | grep 'cf-cache-status'
# > cf-cache-status: HIT
from badgen.net.
Maybe you could use the free plan of Cloudflare to cache live badges for a few minutes, and static badges for a whole week!
You can't. Badge service is a tricky thing. Users are constantly updating things, so you can't just say "cache everything for few days or weeks".
And with "tricky" i mean, that it should be fresh and not cached, by design. Yea, some small & smart caches is okey, but not aggressive caching.
As about the home page.. I would answer "And what?". It's preview and that's normal, users are not using the home page, but few badges at their readmes.
But yea, there is a way to decrease the stats for the homepage. Show only Usage & Example's Static sections, but not the Live badges section. And provide search. But still, that's not cool thing, because forces interested people to do more (e.g. type in a search field) - it's just not cool and it's not beautiful.
from badgen.net.
All right, I didn't realize Now CDN was using Cloudflare ! That's great!
They don't tell if your bandwidth quota is consumed though, but I hope the answer is no..
@olstenlarck The live badges in the home page are just examples, they don't need to be exact all the time! I don't know how, but badges could have a longer cache time when seen from the homepage...
I'm just throwing ideas here, cause I think that homepage is using a huge part of your server's ressources, but again, they're juste ideas, I don't have real solutions right now
from badgen.net.
Changed the response badge to /npm/v/ava
, formerly it's response time from home page.
BTW, saw a traffic spike yesterday :D
Scale
dc min max current
sfo1 1 3 1
bru1 1 3 1
Events
2018-08-22T14:24:37.763Z state INITIALIZING
2018-08-22T14:24:39.794Z build-start
2018-08-22T14:25:10.403Z build-complete
2018-08-22T14:25:10.463Z state READY
2018-08-22T14:25:12.000Z instance-start (sfo1)
2018-08-22T14:25:52.262Z scale-set
2018-08-22T14:25:54.000Z instance-start (bru1)
2018-08-22T14:26:23.066Z scale-set
2018-08-22T14:26:28.493Z scale-set
2018-08-22T14:26:34.937Z scale-set
2018-08-23T05:29:52.000Z instance-start (sfo1)
2018-08-23T09:12:31.000Z instance-stop (sfo1)
from badgen.net.
So, the cache you're talking about is browser cache, meaning I won't call the API multiple times if I reload the index page again and again.
However, if 100 different people visit badgen.net in a short time interval, you will consume 100 * 144kB = 14Mb
of bandwidth!
That's where a cloudflare layer could be useful: it would remember the badges responses and serve them again until the cache expires, without even calling the badgen API
from badgen.net.
Related Issues (20)
- Some hackage badges just display "badgen error" HOT 6
- Enhancement: Ad support for github workflows.
- Some flat badges are not flat HOT 2
- Flat GitLab badges are no longer flat
- Enhancement: Create ARM64 image and push to dockerhub HOT 1
- [REQ] sourceforge - and not only - support
- badgen.net don't respect `cache` option HOT 1
- Including icon parameter provide incorrect response image HOT 4
- [Bug] Bundlephobia badges unreliable, returning 429 HOT 3
- [REQ] codeberg.org support HOT 5
- Cannot find module './public/.meta/badges.json'
- [Enhancement] distinguish between error message and correct value HOT 1
- [idea] range for pypi python versions HOT 2
- Wrong number of chrome web store users HOT 3
- [Feature Request] Github Language
- badgesize badge is broken
- 404 error on all Codecov badges HOT 4
- `api-` folder typo? HOT 2
- Twitter errors out - remove? HOT 1
- Update README directions on where to put new badge HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from badgen.net.