Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Investigating high bandwidth usage in a Sanity project

18 replies
Last updated: Oct 2, 2023
Hi Sanity Help,
I noticed spikes in bandwidth usage which do not not entirely correspond with other usage metrics (see attached).

This is a tiny project with virtually no users so the high bandwidth usage is odd. I would like to identify the cause of the high bandwidth usage before adding new users.

Could you please provide logs or other data that could help me identify the cause of the high bandwidth consumption? I am interested in 24th September in particular.

Many thanks,

User
Oct 1, 2023, 9:33 AM
Hey,
user V
. Although I'm not part of the Sanity team, there are some quick solutions you can employ here.First, it is common for projects to fetch data all the time from Sanity. If your website is targeted by a bot or even a malicious user, this can cause spikes in data usage.
The most common solution to problems of that nature is adding a caching mechanism which will stop data from being fetched on repeat.
Oct 1, 2023, 4:36 PM
Hi
user Z
, thank you for your response. Hopefully the Sanity team will be able to retrieve data about the requests which are causing these spikes.
Oct 2, 2023, 5:54 AM
Can you share your project ID?
Oct 2, 2023, 4:28 PM
Hi
user M
, certainly. I have DM-ed (not sure public they are)
Oct 2, 2023, 7:59 PM
They’re not considered secret but that’s ok!
Oct 2, 2023, 8:13 PM
OK, it looks like the main consumers are mp3 files. This one in particular is the largest:
<https://cdn.sanity.io/files/u1y1uu6u/production/2fd7254ab4676e2c40fc2397888a26d69daf8abf.mp3>
Oct 2, 2023, 8:21 PM
Thanks User. OK that makes sense but I am surprised by the amount consumed, especially on 24th September. Is there there additional metadata, e.g. User Agent?
Oct 2, 2023, 8:44 PM
The project is on the free tier and we’ll naturally upgrade but I just want to ensure I’m not doing anything wrong.
Oct 2, 2023, 8:46 PM
In depth reporting like that is only available on Enterprise plans, unfortunately. What stack are you using for your frontend?
Oct 2, 2023, 8:53 PM
Ok we’re not quite there yet!
There are two frontends:

• iOS app (Sanity content exposed via NodeJS-based API)
• web (NextJS hosted in Vercel) but it doesn’t play audio so won’t consume MP3s
Oct 2, 2023, 8:56 PM
Can I assume that the majority of the bandwidth consumed is due to the audio files?
Oct 2, 2023, 8:58 PM
Did you happen to be doing a lot of development on the24th?
Oct 2, 2023, 8:58 PM
Quite possibly. Will take a look
Oct 2, 2023, 9:01 PM
OK actually I was debugging some playback issues in the app. 3GB is pretty hefty but perhaps the app doesn’t do proper client-side caching of the audio
Oct 2, 2023, 9:05 PM
That sounds like the likely cause!
Oct 2, 2023, 9:09 PM
Ok thanks for your help User.
Oct 2, 2023, 9:10 PM
Much appreciated!
Oct 2, 2023, 9:10 PM
Happy to help!
Oct 2, 2023, 9:13 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?