New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preview feature feedback: jsonProtocol
#18095
Comments
|
The lack of bug reports is really indicative of the quality of the release. Thanks, Prisma devs! |
Thanks 😆 The team will love to hear that. Note the linked issues #18200 though, we seem to have missed a few details around enums. And I honestly hope we will get a few "I measured, and this is now x% faster" messages... |
@janpio I haven't done a very thorough analysis and my app still needs a lot of tuning but at first glance I'm seeing some pretty decent improvements in performance in Vercel. Some observations on one function: Without "jsonProtocol" I was seeing ~790MB memory usage running upwards of 10 seconds on cold starts. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Just wanted to report that enabling Nice work Prisma team :) |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Enabling |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
When I am testing this out locally I am not seeing a change in memory usage, I am setting the |
are u running "prisma generate" after changing? |
I did yes. I can try it again though and just triple check. (I actually tried with the env var first but didn't see a change so then tried using the previewFeatures) I was running the server with |
Could you try |
This comment was marked as outdated.
This comment was marked as outdated.
@yharaskrik |
Ok I tried again and checked the protocol in the debug messages (measurements in MB) JSON Graphql |
Did some additional measuring with and without Prisma with the API idling:
So Prisma adds about 65MB regardless of protocol. |
In your two videos, they are almost equal, even I didn't see a 2, 3 seconds speed difference |
I've tested a bit now with an example dataset I found, quite few models, quite few rows in the schema. But I went from ~4500ms to ~500ms in cold start times on Vercel serverless (NextJS API functions). EDIT: Unfortunately, this seems to just have been me not waiting enough for it to become a cold start. Now I'm getting ~4000ms startup again. So an improvement, just not very large. And to be fair, trying cold start times without any prisma calls is still really slow. |
(Sorry, quote replied to the wrong message) Did you figure out a solution to this one? I am experiencing the same issue
|
Hello, We have been testing We have run into one "issue":
Which started to emit the following error after enabling
We have since updated My understanding is that this is likely the intended behaviour. Just flagging that it does appear to have become stricter with the new protocol. |
Correct @johnjcsmith, this is one of multiple changes to the "array shortcuts" that we did to clean up our APIs. We will introduce these as breaking changes in Prisma 5 when we make |
Thank you everyone for the feedback 🙌🏼 We’re thrilled to announce that the We introduced this feature in version 4.11.0 to improve Prisma’s performance. Previously, Prisma used a GraphQL-like protocol to communicate between Prisma Client and the query engine. Applications with larger schemas had higher CPU and memory consumption compared to smaller schemas which created a performance bottleneck. The JSON-based wire protocol improves efficiency when Prisma Client is communicating with the query engine. If you want to learn more about the performance improvements that are bundled with Prisma 5, including the JSON-based protocol, we recommend giving Prisma 5: Faster by Default a read. |
Link is 404? |
@ayvanov Sorry about that, stay tuned, the blog post is not published yet but should be coming very soon! |
@ayvanov Here it is https://www.prisma.io/blog/prisma-5-f66prwkjx72s ✍🏼 |
Our new Json Protocol is in early preview since 4.11.0.
During performance investigations and optimizations, we noticed that the existing protocol implementation using GraphQL added a CPU and memory overhead that was especially noticeable for larger Prisma schemas. Therefore, we found an alternative way to express our queries without needing that overhead: JSON.
To try out the new protocol, enable the
jsonProtocol
Preview feature in your Prisma schema:Regenerate Prisma Client to use the new JSON protocol.
For environments or situations where it is not viable to enable the Preview feature flag to your Prisma schema file, we also added an environment variable that you can use to force the use of the JSON Protocol Preview feature:
PRISMA_ENGINE_PROTOCOL=json
.Note: This is an early Preview feature with a significant limitation: Invalid input to Prisma Client will throw unpolished, internal errors that are less descriptive and user-friendly than our usual ones. We intend to improve these future releases.Using it with Data Proxy and Prisma Data Platform currently also leads to errors.We expect using
jsonProtocol
to improve Prisma Client's startup performance and memory usage significantly. This will likely have a more significant impact on applications with larger Prisma schemas.We would appreciate your feedback on this feature on the following particularly:
For feedback, please comment on this issue.
Please share your feedback about the
jsonProtocol
functionality released in v4.11.0 in this issue.The text was updated successfully, but these errors were encountered: