Skip to content
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

Ultra-slow first request performance #936

Open
blecorre-mnp opened this issue Apr 8, 2024 · 4 comments
Open

Ultra-slow first request performance #936

blecorre-mnp opened this issue Apr 8, 2024 · 4 comments

Comments

@blecorre-mnp
Copy link

blecorre-mnp commented Apr 8, 2024

Describe the bug
We have been using EdgeDB in production for a while, and a few months ago updated our NodeJS version from v16 to v18 and more on multiple projects. We have been experiencing ultra-slow first request performances, every time our EdgeDB client is trying to execute a request after a while.

Reproduction
As this is a performance issue, I guess it might be kinda hard to replicate. We have a small DB with 56 types and 16380 objects, and this way of running requests.

import { createClient } from '~/edgedb';
import * as EdgeDB from '.../edgedb.ts';

// Single use client
request.run(createClient());

// Or using a shared client (imported from 'edgedb.ts')
request.run(EdgeDB.client);

Expected behavior
Initial request should not take up to 50x more time to run than following requests.

Versions

  • OS: MacOS / Linux
  • EdgeDB version: 4.5+641a8f3
  • EdgeDB CLI version: 4.1.1+a774177
  • edgedb-js version: 1.4.1

We tried a lot of Node versions such as v18.16.1, v19.8.1, v20.8.0, v20.11.0, v21.6.0. We also tried Bun v.1.1.0 and got the same results.

Thanks for your help!

@blecorre-mnp
Copy link
Author

As an example of what's happening, here are the comparison of request time between Node versions, from Node v16 to the left to the newest versions down the line.

Screenshot 2024-04-08 at 11 14 17

Everytime the server idles a bit, you can see this kind of metrics when a new request comes in.

Screenshot 2024-04-08 at 11 16 25

@jaclarke
Copy link
Member

jaclarke commented Apr 8, 2024

How are you running the edgedb server? If you're using the edgedb cli tool to create the instance, then this is the expected behaviour. Since instances created with the edgedb cli are intended for local development, and we don't want to use all your system resources if you have a lot of instances, the server is configured to shutdown after being idle for some time, and will restart using socket activation on the next query. For production use you should setup the edgedb server using one of these guides: https://docs.edgedb.com/guides/deployment, or use edgedb cloud.

@blecorre-mnp
Copy link
Author

We are running EdgeDB servers on bare metal Ubuntu instances. The EdgeDB server did not change between the Node 16 and above transitions we did.

@blecorre-mnp
Copy link
Author

I also noticed that this happens on the EdgeDB UI app side of things enabled on the production server. Could this be linked to the complexity of the DB and therefore be more appropriate to talk about this in the EdgeDB repo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants