Description
New Feature / Enhancement Checklist
- Report security issues confidentially.
- Any contribution is under this license.
- Before posting search existing issues.
Current Limitation
Because parse-server is compiling a lot of unused dependencies (Live Queries, Postgres, redis, ...), the startup is slow.
It prevents us from using Parse in cheap configurations of serverless hosting solutions, like Google Cloud Run with min-instances=0 .
Feature / Enhancement Description
Feature request : a fast startup,
prevent those unused dependencies from compiling, maybe by putting the imports inside conditions. For instance :
static async createLiveQueryServer(
httpServer,
config: LiveQueryServerOptions,
options: ParseServerOptions
) {
if (!httpServer || (config && config.port)) {
var app = express();
httpServer = require('http').createServer(app);
httpServer.listen(config.port);
}
import { ParseLiveQueryServer } from './LiveQuery/ParseLiveQueryServer';
const server = new ParseLiveQueryServer(httpServer, config, options);
await server.connect();
return server;
}
Example Use Case
You're starting a new project. With a fast startup, you can have a nice server (4 Go and 2 CPUs) for almost nothing.
On Cloud Run, the CPU is turned off between requests, you only pay for the RAM, and after 15 minutes, the instance is unmounted. Add to this the fact that, in a month, 60 CPU-hours are free and 125 Go-hours are free.
But for this, you need to be able to have a fast startup. In my current project, a cold restart takes approximately 12 seconds. I think we could reach a few seconds.
Alternatives / Workarounds
I can put the min-instances to 1. When a second or third instance is started, Cloud Run waits before sending requests.
And between requests, when there's no CPU, you only pay for RAM and a special fee for "inactive instances".
Details
Here's a startup profile with all the unnecessary compiled code in red (at least 70% of all the compiled code).
It's on my big local machine. On the server, all time are multiplied by 4, at least.
There might be another problem : all the schemas are loaded at once to build the cache, but let's stick with the compilation issue for now :)
thx