<@U3D8LQ8HK> sorry for the tag, but you’re the onl...
# orm-help
l
@nikolasburk sorry for the tag, but you’re the only one from Prisma team I’ve seen in the Prisma slack. Hi, I’m Lukas, and have been leading a development team for an e-commerce service fully exploiting Prisma + GraphQL as backend. So far, I’m so grateful to Prisma team with astonishingly convenient features it provides! So, my question is if Prisma 2 server could be hosted in a fully serverless way. Now we’re delivering Prisma data layer with AWS ECS Fargate, but it’s not quite serverless. We try to manage all the resources as serverless way as possible. Thanks for your awesome efforts on Prisma again! 😄
🙌 4
s
I asked this from the Prisma team last week and they responded with a resounding yes! So you should be able to host a javascript graphQL api as a lambda function behind an API gateway and just connect to something like aurora serverless as your database.
h
We’re using a similar tech stack at our company for a project : aurora, fargate/prisma, lambda I would love if prisma 2 had first class support for AWS infrastructure
s
@Hebilicious That looks like an awesome stack and one that I was thinking about as well but I wasn’t sure what the minimum cost per month would be. Would the smallest size fargate instance be querying the serverless aurora infrastructure enough that both the aurora and fargate would essentially be on 24/7? (Which would turn out to be $36/month for the fargate (based on $0.05/hr) and $30/month of aurora on a db.t3.small- or $66/month- at least I think.)
v
Hey! So it means that we will be able to use Prisma 2 with serverless provider as Zeit Now as well ?
n
Hey @Vincent P 👋 yes, in fact we have an example for this setup here: https://github.com/prisma/prisma-examples/tree/prisma2/deployment-platforms/zeit-now 🙂
v
So cool! Thanks ❤️
Do you have any feedback / metrics about Cold boots & DB connection handling to evaluate Figma as a serverless orm?
Hey @Stephen Jensen I just set up a stack based on RDS / Prisma 2 deployed on Zeit Now. Your repo blog-prisma2 was useful 🙂 Thanks for that! It's a side-project but I was a bit worried about performances. Mainly due to serverless and cold start I suppose. I've experienced <1200ms response time from this graphql server. Do you know if we can expect better performance?
s
That’s a great question and one that I don’t have a quick answer for. I read a blog that showed how much faster cold starts are now compared to even a few years ago so I expect that to go down further just on the AWS environment itself. Also keep in mind that prisma 2 can only run one request at a time currently and that will be lifted when it goes v1.0. One thing that might give you an idea of baseline is to measure the response time of the server locally or when it is running in a docket environment where there are active servers.
@Vincent P also, I’m glad you liked the blog repo that I put together. I just pushed an update yesterday so that it works with the preview 14, so you might want to take those changes to make sure that you have the latest and greatest.
v
Thanks! I am not sure to understand how prisma2 (photon, right?) parallelism would improve performance on serverless as I suppose that parallelism is handled on the higher level. A lambda is triggered for each request I mean. I compare requests (basic Query) launched against local server (remote db) & Zeit Now lambda: - 1200 ms locally - 2900 ms lambda Yep, I've already checked your PR (and watched your YT video btw, 👍 🙂 )
@Stephen Jensen I also think that fixing n+1 problem would improve those (embedded) requests
s
@Vincent P Thanks for the stats back- I wanted to see if an actively running server would be faster than calling a lambda and it certainly seems like it does which tells us that likely the fastest that the lambda could ever be (without prisma2 improvements) would be is the 1200 ms that you mention there. Your point about the n+1 is interesting- I have never actually tried using the DataLoader plugin with any of my graphQL backends. I wonder if there are any prisma examples that utilize this or if (even better) that they could handle that under the hood of the prisma library. 🤔 Are you doing a lot of n+1 type queries (i.e. fetching people and all their books?)
v
Yes. Actually it’s my main motivation to use graphql. To be able to request nested object easily. I’ve read that prisma team will work on this to include in the GA release.
s
Ooh I just looked into it and you are totally right. Apparently they had data loader with the prisma 1 bindings package. Here’s the ticket to track it for version 2: https://github.com/prisma/photonjs/issues/153 😎
v
Yep exactly! So nice they'll put in the GA release. I've spent 2 days developing with prisma2. The dev experience is really awesome, without too many tools 😊 The only real bad thing is really poor performance, so far. Do you know what is the best way to contribute? - I did really appreciate what you did with your videos. Not sure where to start to be useful for the project.