Next.js Discord

Discord Forum

How to minimize bandwidth on 10 Mb req payloads

Unanswered
Tomistoma posted this in #help-forum
Open in Discord
Avatar
TomistomaOP
I'm already hitting 100Gb Fast Origin Transfer (bandwidth) on Vercel's Pro Tier.

This is because my app homepage loads all the data it needs (10 Mb JSON: 3,000 4Kb elements) for quick interactivity client side. So 10k pageviews will already make me pay extra for bandwidth, at $6 for 100Gb, Supabase after 250k Gb is $9 per 100Gb, thus $1.50 just for 1,000 page views.

I don't need fresh data from the DB every time, it doesn't change. So I could cache it with Vercel's data cache, I just have to do some chunking to get each chunk from the DB under 2 Mb.

But if Vercel's Data Cache is $0.40 for 1 million Read Units (8Gb), isn't that just paying the same bandwidth charges, $4 for 80Gb, but saves my DB egress/bandwidth?

Is there any way the caching can happen earlier (but after browser) so all users just get the same cached 10Mb or 5x 2Mb JSON and I don't incur 10 Mb bandwidth from every new visitor?

Otherwise, I think the typical answer is "Don't load 10Mb", in which I have to react to a user's input, to then fetch the data and display, resulting in some 500ms latency or so

0 Replies