Lambda Cold Start, influenced by schema size
See original GitHub issueBug description
Continuing from #10724 - please see there for more details. It contains data I gathered while profiling lambda cold starts with prisma.
Problem: lambda cold starts are increased by importing prisma.
I believe part of the problem is that despite us having a medium-sized DB schema, a very large DMMF string (6,492,708 characters) is produced which must be parsed at startup. The difference in startup between an empty DMMF string and a large one is around one second.
Please see the repro repo: https://github.com/jetbridge/prisma-bundle-size
Using the repro repo you can observe the difference in startup time for two lambdas, one without prisma and one that imports prisma and tries to do a query with DATABASE_URL=file:./dev.db
set.
My goal is to reduce the cold start time of my lambda functions that use prisma as much as possible.
How to reproduce
See repo README
Expected behavior
No response
Prisma information
3.8.0
Environment & setup
- OS:
- Database:
- Node.js version:
NodeJS 14 on AWS Lambda
Prisma Version
prisma : 3.8.1
@prisma/client : 3.7.0
Current platform : darwin
Query Engine (Node-API) : libquery-engine 34df67547cf5598f5a6cd3eb45f14ee70c3fb86f (at ../../../../usr/local/lib/node_modules/prisma/node_modules/@prisma/engines/libquery_engine-darwin.dylib.node)
Migration Engine : migration-engine-cli 34df67547cf5598f5a6cd3eb45f14ee70c3fb86f (at ../../../../usr/local/lib/node_modules/prisma/node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine : introspection-core 34df67547cf5598f5a6cd3eb45f14ee70c3fb86f (at ../../../../usr/local/lib/node_modules/prisma/node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary : prisma-fmt 34df67547cf5598f5a6cd3eb45f14ee70c3fb86f (at ../../../../usr/local/lib/node_modules/prisma/node_modules/@prisma/engines/prisma-fmt-darwin)
Default Engines Hash : 34df67547cf5598f5a6cd3eb45f14ee70c3fb86f
Studio : 0.452.0
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:14 (6 by maintainers)
Top GitHub Comments
Let me join this thread. My Prisma schema is around 15k lines and Cold Starts are high
@janpio I am not sure that there is a direct influence. I am about to get access to x-ray from devops, once I get I will provide the results.