Preview feature feedback: `jsonProtocol`
Problem
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: [code block] 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: 1. Does using this preview feature introduce any regressions or problems in your app
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: Preview feature feedback: `jsonProtocol`
@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. I'm using a SQL Server DB with ~8,700 line schema file. Some observations on one function: Without "jsonProtocol" I was seeing ~790MB memory usage running upwards of 10 seconds on cold starts. With "jsonProtocol" I'm seein
Trust Score
6 verifications
- 1
@janpio I haven't done a very thorough analysis and my app still needs a lot of
I'm using a SQL Server DB with ~8,700 line schema file.
- 2
Some observations on one function:
Some observations on one function:
- 3
Without "jsonProtocol" I was seeing ~790MB memory usage running upwards of 10 se
With "jsonProtocol" I'm seeing ~330MB memory usage and upwards of 6 seconds on cold starts.
Validation
Resolved in prisma/prisma GitHub issue #18095. Community reactions: 13 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep