Skip to content

Expensive default variable creation #1020

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

Closed
rosstimothy opened this issue Mar 31, 2025 · 2 comments · Fixed by #1021
Closed

Expensive default variable creation #1020

rosstimothy opened this issue Mar 31, 2025 · 2 comments · Fixed by #1021

Comments

@rosstimothy
Copy link
Contributor

The RSA keys generated for the defaultServer global variable have a dramatically negative impact on any consumers of the server package.

var defaultServer = NewDefaultServer()

This can be measured using GODEBUG='inittrace=1' on any programs that imports github.com/go-mysql-org/go-mysql/server.

From a M2:

212 ms github.com/go-mysql-org/go-mysql/server

From a t3.xlarge:

537 ms github.com/go-mysql-org/go-mysql/server

@lance6716
Copy link
Collaborator

I think we can use sync.Once to lazily create the defaultServer. Welcome to contribute

@dveeden
Copy link
Collaborator

dveeden commented Apr 1, 2025

@rosstimothy could you check #1021 ?

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

Successfully merging a pull request may close this issue.

3 participants