T3 is severless, yet uses prisma— how...?

Still confused about how database connections work from short-lived workers. Is https://prisma.io/docs/data-platform/data-proxy the only way? Say you have a t3 fullstack vercel app and a railway DB. You don't just plug the DB url into prisma client, do you?
Prisma
Data Proxy
Learn about using the Data Proxy with the Prisma Data Platform
27 Replies
Neto
Neto2y ago
you can
Q: Will AWS Lambda reuse function instances?

To improve performance, AWS Lambda may choose to retain an instance of your function and reuse it to serve a subsequent request, rather than creating a new copy. To learn more about how Lambda reuses function instances, visit our documentation. Your code should not assume that this will always happen.
Q: Will AWS Lambda reuse function instances?

To improve performance, AWS Lambda may choose to retain an instance of your function and reuse it to serve a subsequent request, rather than creating a new copy. To learn more about how Lambda reuses function instances, visit our documentation. Your code should not assume that this will always happen.
if you do very occasional requests for the lambda you will have coldstarts
chmod
chmodOP2y ago
this could potentially run out of db connections at scale?
Neto
Neto2y ago
that kind of thing is on the dbside of things no longer t3
chmod
chmodOP2y ago
if amount of lambadas > greater than db can support
Neto
Neto2y ago
but yeah, can happen connection pools is a issue related to the database
chmod
chmodOP2y ago
so how do people resolve that in the real world ive only seen prisma data proxy address that
Neto
Neto2y ago
increasing the pool
chmod
chmodOP2y ago
huh
Neto
Neto2y ago
Shoubhit Dash
Typesafe Database Queries on the Edge
Edge computing is all the rage. Learn how to get typesafe access to data on the edge using Kysely, Prisma and PlanetScale.
Neto
Neto2y ago
as a example you can use planetscale serverless driver
chmod
chmodOP2y ago
ah rest api
Neto
Neto2y ago
so you dont need to create a new connection on every new lambda container
chmod
chmodOP2y ago
right
Neto
Neto2y ago
btw, prisma data proxy is awful
chmod
chmodOP2y ago
how so?
Neto
Neto2y ago
slow
chmod
chmodOP2y ago
ah. that sucks seemed like the holy grail to my inexperienced eyes going serverless
Neto
Neto2y ago
if you really want you have serverless databases as well planetscale for mysql cockroachdb for postgres
chmod
chmodOP2y ago
do non-serverless db's still make sense when accessed from serverless functions? If the whole point is that the lambda runs close to the user, the database being in a different location isn't a conflict to that philosophy? the phrasing of that answers this ^
Neto
Neto2y ago
you can have distributed systems but you are confusing lambdas and edge funcions
chmod
chmodOP2y ago
you're right, I am edge would be cloudflare, lamba would be vercel nope edge too
Neto
Neto2y ago
vercel serverless run on aws lambdas vercel have edge functions, but its a different product
chmod
chmodOP2y ago
ah, well thanks for the numerous corrections in my understanding, you answered the questions I didn't know how to ask lol
Neto
Neto2y ago
np
Neto
Neto2y ago
Fireship
YouTube
Is "edge" computing really faster?
Edge computing is becoming a popular way to deliver modern web applications. Let’s find out if the Edge is really faster by comparing Firebase to Vercel Edge Functions with Next.js. #webdevelopment #javascript #vs
🔗 Resources Next Firebase Course https://fireship.io/courses/react-next-firebase/ Next.js 12.2 Release https://nextjs.org/blog/...
Igal
Igal2y ago
if using a serverless client / data api is not an option, either because target db doesn't support it OR because its serverless client / data api don't support some crucial characteristic (e.g. no transaction support).. you can limit concurrent lambda invocations with reserved concurrency OR distribute to N groups in SQS FIFO. can also offload to custom built batch job or dump to s3 (some databases support s3 ingest). that's off the top of my head...
chmod
chmodOP2y ago
very cool to hear those new potential solutions, haven't thought about engineering database integration like that, thx!
Want results from more Discord servers?
Add your server