Ability to perform a tRPC request form a terminal, curl-like
Hey, I wanted to ask if there is conventional a way to do that? I wanted to warmup my lambda but can't find a dead-simple way to stick this into a cron. TY!
10 Replies
What are you trying to achieve?
My API has a warmup endpoint which the frontend calls on page open before any bigger calls are required, so the UI can present a warmup spinner
If you want your API perpetually warm though, lambda has a provisioned capacity you can set to do this
Hey Nick, I want to call a tRCP endpoint to warm it up. It's on Vercel, let's say. I want this function to be always warm there, so have a cron job to call it ever x minutes
I see what you mean with the warmup on the frontend side, it could work yeah.
In general, best to let it scale to 0 if there's no dedicated capacity controls
Focus on optimising cold boots in my opinion
But you could could the tRPC client with a little node.js script to hit a healthcheck endpoint if you like
I think I'll just curl the /<route>.<query>?batch&input&from 🤔
It seems to work
Yeah doesn't even have to be a valid URL probably!
With the way serverless creates new instances during surges in loads, you're probably not going to avoid cold boots is all. The first few users might benefit but everyone else will eventually get a slow response
public endpoint seems to works fine with a regular curl, at least locally
With the way serverless creates new instances during surges in loads, you're probably not going to avoid cold boots is all. The first few users might benefit but everyone else will eventually get a slow responseThat's true. Unless I know how many users I need and pre-scale it that way.
At this point just move off Vercel haha
yeah
What I want at this stage is that those 5 users hitting my app to be happy hehe
so the answer would be to run a get request towards an endpoint in a right format
I've heard good noises around this for people who find serverless isn't right for them but want simple
https://www.flightcontrol.dev/
Flightcontrol — AWS Without Pain
AWS Without Pain. Deploy, preview, & scale. DevOps not required. By the team behind Blitz.js
Thank you!
I don't mind running my own k8s cluster, I'm from OPS. What I want is to bridge the gap between Vercel and AWS, and for now I'm solving the Vercel part, since a lot of people start using it and getting thrown away by cold starts
TBH, I don't like super hard wrappers like this around cloud. They create some "false control percepton" I could be wrong though hehe
Thanks again Nick
I'll probably continue asking stupid questions on this discord 😂