PLEASE help us help you by writing a good post!
- Site
festive-hopper-1abe84
or https://theologic.us
For the first time ever, I got an Netlify email Your bandwidth usage on your team (Theologicus) has reached 50% of the current allowance in your billing cycle from February 22 to March 22
.
This blows my mind because my site is a mdbook site with very few media files (small images, no audio/videos).
I have enabled all metrics (incl. real user) to try to get to the bottom of it.
The only culprit I can think of is that my 9:08:48 AM: 2024-03-01 14:08:48 [WARN] (mdbook::renderer::html_handlebars::search): searchindex.json is very large (22980260 bytes)
. But that is in megabytes. Yet, when I go to my Metrics page, I see that my site is jumping 4GB every day.
Is there something else I can check?
2 Likes
Hi, @josephlouthan the bandwidth metric is mainly affected by your site’s traffic. Even if the site itself is quite small, if hundreds of people visit it and each one makes a request ~10 times (to navigate your site) then that’s 10x the amount of bandwidth… and consequently those small requests add up.
You could combat this in several ways like caching, using SPA technologies or anything else to minimize the amount of requests sent to the server for each visitor.
With regard to the large JSON file (searchindex.json), I have a few suspicions. Are you requesting this file on input of the site’s search bar? Also I have looked at the Network logs of your site and it seems you are requesting the favicon of the site on every keydown… this may explain the high bandwidth.
I’d suggest checking what other requests are made in quick succession. As I would agree (on the grounds that your site does not have high traffic) that 4gb per day is quite excessive.
If you have any more questions, make sure to ask
Reached out to Support and they found the culprit:
Your largest User Agent by far was Bytespider. This is a bot from Bytedance, the company that owns Tiktok.
ua |
bytes |
gb |
|
Mozilla/5.0 (Linux; Android 5.0) AppleWebKit/537.36 (KHTML, like Gecko) Mobile Safari/537.36 (compatible; Bytespider; spider-feedback@bytedance.com) |
72008470986 |
67.06 |
|
If you do not wish this bot to visit your site, I would recommend programming an Edge Function to block traffic by User Agent. You can see examples of them here to give you some ideas: https://edge-functions-examples.netlify.app/
1 Like