BB
BB2mo ago

Crazy high bandwidth usage

Hi All I'm having a real problem keeping under the bandwidth limits. I have a tiny amount of data that is being pulled to produce some dashboard analytics and charts etc. My understanding was that Convex handled the caching and so i didn't expect the usage to be what it is. I am only pulling a few hundred rows of very basic financial data but am using about 200mb of bandwdith after a few minutes of running the server. Any advice? I am using indexes and trying my best to optimise the queries.
8 Replies
Convex Bot
Convex Bot2mo ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
sujayakar
sujayakar2mo ago
hey! yeah, 200MB of bandwidth for a few hundred rows (which I'm assuming are pretty small) doesn't seem right. we're working on improving profiling to make this easier to track down. but in the meantime... - in the project usage view, how much of the bandwidth is from reads vs. writes? - do you see a lot of function calls? i'm curious if the issue is that functions are running too often vs. each individual function call is reading too much data. - in the breakdown views at the bottom of the usage page, you can see which functions are getting called the most and which are taking up the most bandwidth.
BB
BBOP2mo ago
Hey! Yeah its all reads - Really getting difficult to see how this scales?
No description
No description
No description
lee
lee2mo ago
can you tell why the queries aren't getting cached? it doesn't look like the data is changing, so maybe the args are changing? it's also possible that your query is reading Date.now() and can't be cached for long because the date is changing
BB
BBOP2mo ago
Hey @Lee Yeah i think the date.now might have been causing part of the issue. I can see that the queries were runnign all through the early hours of the morning when i know the local server was turned off and I was obviously asleep - why would they be runnign then? This seems like it would also add to the bandwidth usage when it doesn't need to be making those queries
No description
BB
BBOP2mo ago
Cache Hit-Rate is still fairly low - any ideas why?
No description
djbalin
djbalin2mo ago
Could you post the code for the query or describe the data structure? Whats a portfolio timeseries? The cache will be invalidated if the data that your query changes. Also Date.now() inside the body will invalidate the cache almost every time
lee
lee2mo ago
you can pause your deployment if you want to make sure it won't run functions https://docs.convex.dev/production/pause-deployment I don't know why you would getting traffic when you're not looking at the page. maybe a background tab is repeatedly reloading the query?
Pausing a Deployment | Convex Developer Hub
Pausing a deployment is a way to "turn off" a deployment without deleting any

Did you find this page helpful?