fetch seems slow in actions?
I'm trying to do my openai calls from a convex action.
It's consistently taking 7 to 9 seconds in my actions, but it takes 1.5 to 3 seconds when I run it locally.
I'm explicitly timing the fetch, not cold start. Any thoughts on figuring out why it is slower?
3 Replies
I assume it is a node.js action? This is kind of strange to see such a big difference. Node.js uses regular AWS lambda. One difference between you runnning it locally or us running in from the east coast might be latency, in case openai servers are on the west coast, but the delta should be only few rounds trips if we establish SSL connection at 80ms each.
It happens in node and non node versions
Interestingly, if I do it two times in a row, the second time takes 4 seconds instead of 8
(twice in one action, not calling the action twice)
I think I was doing something wrong as I can no longer reproduce
consistent timing across convex and localhost (without about 1 second overhead for convex not attributable to fetch)
Hi Seth! Next time this happens, it might be worth exploring if there is some limiting or warmup time from the api you're trying to reach out to. This is just a guess without knowing the details of what you're exactly seeing.
It would be really quite surprising to see the same timing behavior on two very different runtimes Convex exposes.
I'm glad you're not seeing it now though!