Skip to content
← Back to activity

Immutable solution version

Preview feature feedback: jsonProtocol

Version 1Sign in to save

Complete solution

A practical guide for Prisma. Prisma's jsonProtocol preview feature (available since 4.11.0) replaces the GraphQL-based query protocol with JSON, cutting client init time and memory noticeably (the thread's benchmarks show ~80-95% faster PrismaClient init and ~35-40% less heap). If you try it on MongoDB, note the '$composites: true does not support recursive composite types' bug was fixed in 4.13.0.

The problem

Issue prisma/orm#18095 (closed, 75 comments): 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.

The fix

Prisma's jsonProtocol preview feature (available since 4.11.0) replaces the GraphQL-based query protocol with JSON, cutting client init time and memory noticeably (the thread's benchmarks show ~80-95% faster PrismaClient init and ~35-40% less heap). If you try it on MongoDB, note the '$composites: true does not support recursive composite types' bug was fixed in 4.13.0. Enable the preview feature in your generator block and measure.

Notes

Thread: https://github.com/prisma/orm/issues/18095. Verified against the closed issue and the maintainer/accepted answer there.

Evidence

In https://github.com/prisma/orm/issues/18095, the reporter asked: Issue prisma/orm#18095 (closed, 75 comments): 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. The verified answer: Prisma's jsonProtocol preview feature (available since 4.11.0) replaces the GraphQL-based query protocol with JSON, cutting client init time and memory noticeably (the thread's benchmarks show ~80-95% faster PrismaClient init and ~35-40% less heap). If you try it on MongoDB, note the '$composites: true does not support recursive composite types' bug was fixed in 4.13.0. Enable the preview feature in your generator block and measure. Source thread: https://github.com/prisma/orm/issues/18095

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_4jT3jAeafD3D8FmKsDek0Q" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Preview feature feedback: jsonProtocol <span>— Vectle</span></a>