question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[IDEA] Use cloudflare to cache and save on bandwidth

See original GitHub issue

So this is not a real issue but just an idea.

I see that today, loading badgen.net takes 144 KB of bandwidth, and it will become bigger every time new badges are added.

image

As you said on your comment, the bandwidth usage is already pretty high, and I guess the index page is a big part of it. Also, the response time on uptime robot is now > 500ms, which is a lot more than a few weeks ago.

Maybe you could use the free plan of Cloudflare to cache live badges for a few minutes, and static badges for a whole week! Docs and index could also be cached for a few minutes It could even prevent occasional downtime

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
amiocommented, Aug 13, 2018

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 🤔

2reactions
amiocommented, Aug 24, 2018

Now CDN is really a helpful & important cache layer for Badgen Service, glad we have it since the beginning. 💪

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reduce origin load, save on cloud egress fees, and maximize ...
Cache Reserve helps users serve content from Cloudflare's cache for ... These fees, known as “bandwidth” or “egress” fees, are familiar ...
Read more >
The way you handle bandwidth over-usage - #34 by Judge
The bandwidth you save depends on your traffic and the size of your site. You could have TBs of data used with enough...
Read more >
How can using a CDN reduce bandwidth costs? | Cloudflare
How can using a CDN reduce bandwidth costs? By caching content and making multiple round trips to the origin server unnecessary, CDNs cut...
Read more >
What is caching? | How is a website cached? - Cloudflare
Caching is storing copies of files in a cache so that cached content can be accessed quickly. Learn more about CDN caches, DNS...
Read more >
CDN performance | Cloudflare
A CDN improves the latency by pulling static content files from the origin server into the distributed CDN network in a process called...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found