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

Reduce total time of booting up the registry #653

Closed
mtojek opened this issue Nov 2, 2020 · 11 comments
Closed

Reduce total time of booting up the registry #653

mtojek opened this issue Nov 2, 2020 · 11 comments
Assignees

Comments

@mtojek
Copy link
Contributor

mtojek commented Nov 2, 2020

As the number of packages is growing the package-registry needs more time to validate and load all packages before starting the HTTP server.

There are multiple ways of fixing this issue, including disabling package verification, loading packages once needed or exposing two separate endpoints for health and readiness.

@mtojek
Copy link
Contributor Author

mtojek commented Dec 18, 2020

I looked into the source code -

@ruflin do you think we can disable the validation in package-registry (or add a switch for that in package-storage Docker images)? Packages are validated on the Integrations level, I didn't see any situation in which the package-registry notified about the problem. It will result in decreasing the total boot time.

The other option, separate endpoints for health and readiness, will play better with k8s orchestrator, but it won't decrease the deployment time, so I would vote for the first option.

@ruflin
Copy link
Member

ruflin commented Dec 18, 2020

If we have a "distribution" package with all the packages backed in, ++ on disabling the validation and doing it during the Docker build.

I think there is still value for validation in the case the registry is run to read in packages from a volume where validation was not done before. Could we make validation just a flag?

I assume package-registry still has its own validation or did we switch over the package-spec?

@mtojek
Copy link
Contributor Author

mtojek commented Dec 18, 2020

If we have a "distribution" package with all the packages backed in, ++ on disabling the validation and doing it during the Docker build.

Yes, that's the plan.

I think there is still value for validation in the case the registry is run to read in packages from a volume where validation was not done before. Could we make validation just a flag?

Yes, I was thinking about the flag, which is disabled in the distribution mode (as all packages have been already validated).

I assume package-registry still has its own validation or did we switch over the package-spec?

It's still there as we need to research if there (where) are validation gaps, so we can switch to package-spec. In general the package-spec catches 99% package errors.

@ruflin
Copy link
Member

ruflin commented Dec 18, 2020

Would be great to get rid of the package-registry own implementation for validation and have parity with package-spec.

@mtojek
Copy link
Contributor Author

mtojek commented Jan 4, 2021

Let me split into half and work on the flag first.

Regarding switching to the package-spec - we have to remember that this will introduce another upstream dependency in the package-registry, 3 branches of the package-storage and integrations. In other words, every commit pushed to the package-spec will trigger an avalanche of updates. I wonder if we can louse coupling here or simply accept it (/cc @ycombinator ).

@ruflin
Copy link
Member

ruflin commented Jan 4, 2021

At the moment the "problem" is that each commit means a release (more or less) and in general a package-spec change is driven by a very specific need to the release has to happen immeditately. I wonder if over time the releases become less frequent? I personally like that we don't magically update but avalanche of updates is not great. Automation possible maybe?

@ycombinator
Copy link
Contributor

I'm +1 for switching the validation in the package registry to use the package spec validator (orthogonal to the flag work, of course). As for the update avalanche problem, we should be able to automate this fairly easily by creating downstream projects in Jenkins so each time there's a successful package-spec build, we kick off builds for elastic-package, package-registry, etc.?

@mtojek
Copy link
Contributor Author

mtojek commented Jan 5, 2021

As for the update avalanche problem, we should be able to automate this fairly easily by creating downstream projects in Jenkins so each time there's a successful package-spec build, we kick off builds for elastic-package, package-registry, etc.?

Do you see any magical way to update Go dependency on package-spec (go.mod, go.sum)? It might be tricky as some parts of code are compiled not just embedded (schemas). Of course it will bring us to another problem, when people forget about updating the binaries :) Probably we have to spend time to analyze this issue.

@ycombinator
Copy link
Contributor

Do you see any magical way to update Go dependency on package-spec (go.mod, go.sum)?

I admit I haven't experimented with this in depth but I think go get should upgrade the dependency on package-spec to the next available version (ref: https://golang.org/ref/mod#mvs-upgrade)? Of course, the key with such upgrades being safe is that package-spec follows semantic versioning in that it doesn't break backwards compatibility within a major version.

That said, I see your point that it's not as simple as configuring downstream Jenkins builds. We will need further automation to run the go get and if there's a diff in the go.mod file due to a package-spec version upgrade, to automatically create the PR for it.

Such automatic upgrades will solve the problem of ensuring that any tools that depend on package-spec are always using the latest available version of package-spec. They will not solve the problem of making sure these tools are using the latest features available in package-spec - for this, a manual PR will be necessary.

@ycombinator
Copy link
Contributor

Of course it will bring us to another problem, when people forget about updating the binaries

I assume you are thinking of elastic-package here? I think we've discussed this in the past: elastic/elastic-package#32.

@mtojek
Copy link
Contributor Author

mtojek commented Jan 7, 2021

I'm deploying new releases of package-registry. Once finished I will close this issue as we've one opened for package-spec validation: #626 . The main issue has been mitigated, the boot up time went down to 3-4 secs.

@mtojek mtojek closed this as completed Jan 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants