Luke11.35L
Convex Community19h ago
2 replies
Luke11.35

Was Convex the Wrong solution? Too many calls to Convex for the same data?

Hello everyone. I've been using Convex for about a year and love it, just started noticing a problem in a ReactNative I'm building. I'm the only user of the app right now, but I'm often hitting 400+ Mb bandwidth / day developing. There's only 2Mb total of data stored in Convex. I'm seeing logs in Convex for the same query 5-8 times per tab. The user I'm using only has a max of 12 words (~40 chars) returned by 3 API calls (lists, groups, tags). These values don't change unless the user edits one, but switching to each tab after the app loads results in ~3 dozen calls for these 12 words. Typical usage should require ~20 total calls.

Most queries have no parameters, either their logged in and can load their data or not, so I'm not sure what is invalidating the queries. I do see that some of the calls say "cached" in the logs, but they don't make sense because the first called are the ones that are marked as cached, not the duplicates after (that also have no parameter) & they're still wasting bandwidth. I attached a SS of one tab load. You can see 8 calls to lists:getAll() first 4 cached, 2nd 4 not. The returned value: ["One", "Two"] The calls are repeated on each tab even though the lists don't change & if they did they should be cached in memory at the same time they're persisted. The same is true for all the other calls. There's no variable parameter until the user drills into a data point & those aren't relevant here.

I know Convex is ideal for real time data like chats & interactive features, but its speed is why I wanted to use it. I hadn't thought static data was going to cause a bandwidth problem. I've been trying unsuccessfully to add a cache layer, but reading the documentation's comments about caching seems like I made a huge mistake converting the app to Convex if it's going to rack up bandwidth for data that hasn't changed (and the code knows it).

About to launch, but now think I need to replace it with Postgres or MySQL.

Thoughts/ideas?
image.png
Was this page helpful?