Home
Support Forums

What does actually count in bandwidth?

I have react application that uses tmdb api to fetch movies data and show to user and also I used youtube iframe to fetch trailers of movies so all these images and video that are coming from API counts in bandwidth or only data other than data coming from API is counted as bandwidth data ?

Hi, @Spartan. If our CDN node sends the data, it counts towards the Netlify bandwidth use. If some other system sends the data then it does not count towards your Netlify bandwidth use.

So, how do you know if the data came from our CDN node? The easiest test is to ask this question:

  • What domain name does the data come from?

Sometimes, you can also ask:

  • What IP address does the data come from?

I was able to look at the domain name in this case.

I visited your site (I work at Netlify and was able to find it) and then I looked up a movie. While I did this I had the browser devtools open and examined the network tab.

When I did this, I can see the API calls and traffic for the following domain names:

  • api.themoviedb.org
  • image.tmdb.org
  • www.youtube.com
  • subdomains of googlevideo.com (like r3---sn-nx5s7n7z.googlevideo.com)

There are possibly other domain names involved but those were the ones that stand out. These are not custom domains for your site at Netlify so the traffic is not going to count as bandwidth used Netlify.

Now, if you see traffic for your site name, like my-cool-movie-app.netlify.app (which is not the real name), then those HTTP requests do count as bandwidth at Netlify.

To understand why, just consider where the data is coming from. The HTTP requests to the domains listed above do not point to our CDN (not counting my-cool-movie-app.netlify.app which would point to our CDN). The traffic for those API calls and HTTP requests (technically the APIs calls are also HTTP requests) happen directly between the browser and those third-party service. We (Netlify) don’t send the data so it would make sense for us to count it.

Our Netlify CDN never sees that traffic. The HTTP requests go to Youtube and TMDB servers, not ours. That traffic therefore does not count at all towards your bandwidth use at Netlify.

We at Netlify literally have no way to even know that traffic is happening. It is completely invisible on our side because it is 100% between the end user’s browser and the third-party API. Netlify isn’t involved in any way.

Now, if the traffic is coming from the custom domain for your site (or the site subdomain under netlify.app) then that traffic does count toward bandwidth at Netlify. That isn’t the case with your site though.

If there are other questions about this, please let us know.

Thanks @luke and sorry I am new to web development and hoisting and the response you provided is absolutely amazing and very much clear. If you have moment can you just clarify that I understood it correctly or not

So Netlify Bandwidth counter increases only when the number of users visiting my site increases ?

And also the build files that are deployed on Netlify their sizes count as bandwidth for every user who visits my website rather than the Api data ?

Not necessarily. Bandwidth can also spike if one user spams your website with visits as Netlify would still have to serve content to that user. However if your website is served from browser or service worker’s cache, you might be able to save a little amount of bandwidth in that scenario. But in general cases, yeah, as your visitor count goes up, bandwidth would also increase.

Build files count against your storage quota, which I think there’s no hard limit enforced on typical websites. So in an hypothetical situation, if you deploy a 100 GB file, it won’t be counted against your bandwidth unless it’s requested by some user. So yeah, the simplest way to understand this might be to see which file is served by your website and which not. In case of sourcing data from TMDB and YouTube, you’re answering your own question - it’s their servers who are actually serving the data, thus it’s them who counts the bandwidth. But, on every webpage load, every CSS, JS file served by your website would count against your bandwidth quota.

Thanks a lot @hrishikesh for clarification actually I am new to web dev and hoisting thats why asking queries thanks for help

It’s no problem. Let us know if you have any other queries.

A quick followup question. If I configured _redirects and proxy API calls thorugh Netlify then that would count against my bandwidth quota?

Thanks

_redirects has nothing to do with bandwidth. But, yes, if you’re using it to call API and send response back to client, that would count against bandwidth because Netlify has to send data back to the user’s browsers.

So it does have something to do with bandwidth :slight_smile: Thanks.

Using _redirects removes some CORS & 3rd party cookie related obstacles but we need to consider the bandwidth/cost impact now.