Skip to content

Remove manifest from Image - #11925

Merged
openshift-bot merged 5 commits into
openshift:masterfrom
legionus:reduce-etcd
Jan 10, 2017
Merged

openshift-bot merged 5 commits into
openshift:masterfrom
legionus:reduce-etcd

Conversation

@legionus

Copy link
Copy Markdown
Contributor

We need to remove manifest from Image to reduce the amount of occupied etcd data. The docker-registry will store the manifest in the storage (where it stores the blobs). It removes the manifest from the Image after fills in all metadata fields. The manifest will be removed when importing the image from an external docker/distribution.

@miminar @soltysh @mfojtik please review.

@liggitt

liggitt commented Nov 15, 2016

Copy link
Copy Markdown
Contributor

isn't this a breaking API change?

@legionus

Copy link
Copy Markdown
Contributor Author

@liggitt Shouldn't.

@legionus

Copy link
Copy Markdown
Contributor Author

@smarterclayton /сс

@smarterclayton

Copy link
Copy Markdown
Contributor

You can't do this without a migration, and removing the field is a breaking change. At best you could stop writing the field for newly uploaded images.

@smarterclayton smarterclayton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to have a way to move manifests back to registry - could maybe be a migration, but has to be gradual.

Comment thread pkg/image/api/helper.go Outdated
return fmt.Errorf("unrecognized Docker image manifest schema %d for %q (%s)", manifest.SchemaVersion, image.Name, image.DockerImageReference)
}

// Remove the raw manifest as it's very big and this leads to a large memory consumption in etcd.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't do this - have to preserve the values.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would strip the value on updates - that has to be gradual.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smarterclayton Fixed. I remove these fields only when you are importing a new image.

@liggitt

liggitt commented Nov 15, 2016

Copy link
Copy Markdown
Contributor

Also, I thought the manifest was only stored as a blob for some schema versions

defaultBlobRepositoryCacheTTL = time.Minute * 10

// Possible storages for manifests.
manifestStorageEtcd = "etcd"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this should be a config variable. Why would admins want this choice? The alternative is to always write manifests to storage, and on reads, look first in storage and only after look in etcd.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smarterclayton As an alternative can be faster storage (e.g. mongodb). For another storage need to implement the distribution.ManifestService interface. I didn't want to hardcode the docker-registry storage and leave the possibility to change it in the future.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smarterclayton This option I removed.

@legionus

Copy link
Copy Markdown
Contributor Author

Also, I thought the manifest was only stored as a blob for some schema versions

No. We always store DockerImageManifest and we store DockerImageConfig for schema v2.

@miminar

miminar commented Nov 16, 2016

Copy link
Copy Markdown

isn't this a breaking API change?

It is. DockerImageManifest will no longer be set on image objects (or rather newly created image objects). We did the same in the past for imagestreamimages and imagestreamtags to reduce traffic.

You can't do this without a migration, and removing the field is a breaking change.

The field is not going to be removed.

At best you could stop writing the field for newly uploaded images.

That's the plan. Additionally we considered to write manifest to registry storage and remove it from image object on each GET /v2/<repo>/manifests/<ref>. But IIRC @legionus doesn't want to grant registry the permission to update images.

Also, I thought the manifest was only stored as a blob for some schema versions

That's true just for config file of manifest schema 2. Manifest objects themselves (of all schemas) have been stored only in etcd until now.

@mfojtik

mfojtik commented Nov 16, 2016

Copy link
Copy Markdown
Contributor

@smarterclayton we don't need a migration IMHO, the new images will replace the old images (they will be pruned) and we gradually migrate users to images with manifests in registry that way.

@smarterclayton

Copy link
Copy Markdown
Contributor

That's the plan. Additionally we considered to write manifest to registry storage and remove it from image object on each GET /v2//manifests/. But IIRC @legionus doesn't want to grant registry the permission to update images.

Since this is about resource usage, I'd be ok with simply having new images go to storage, while old images continue to be in etcd. An admin who cares may need a way to guarantee that it is reimported without breaking existing use cases. But we can solve that separate.

As an alternative can be faster storage (e.g. mongodb). For another storage need to implement the distribution.ManifestService interface. I didn't want to hardcode the docker-registry storage and leave the possibility to change it in the future.

I really see zero chance of us using a different store besides etcd or the storage driver in the near term. We don't need this much flexibility - just having the code automatically prefer to write to the storage, and having creates of images use the manifest to update their extracted metadata but not to store it is sufficient. Update cannot clear the manifest though automatically (the user would have to elect to send an empty manifest or store) because otherwise we would be breaking users who haven't migrated their images.

@legionus

Copy link
Copy Markdown
Contributor Author

@smarterclayton Please change your mind! I think this PR wrong by design.

Move manifests into the registry storage will help us to reduce the etcd and it's ok in the short term. But on the other hand we put the signatures in the Image. They also take place and we can't put them into registry storage. If we will use external storage, we can move there not only manifests, but the signature and tags. Also we can easy implement classification of the images and a quick search using this classification.

In addition, images isn't the only thing that takes place and grows over time. We have a builds. In case of heavy use they will grow and take the place too.

I'm sure in the future we will be faced with the task to remove them from the database.

I'm sure that in the future in front of us will be a challenge to remove them (signatures, tags, builds etc.) from the etcd and if we solve this problem in each case, then in the end it may turn out, the data is scattered in different systems.

We can avoid this if we decide to use an external storage. It does not have to be mongo, but anything with multiple indexes. The mongo first comes to my mind for these purposes.

/cc @pweil- @danmcp @Kargakis @soltysh

@pweil-

pweil- commented Nov 18, 2016

Copy link
Copy Markdown

@smarterclayton Please change your mind! I think this PR wrong by design.

Move manifests into the registry storage will help us to reduce the etcd and it's ok in the short term. But on the other hand we put the signatures in the Image. They also take place and we can't put them into registry storage. If we will use external storage, we can move there not only manifests, but the signature and tags. Also we can easy implement classification of the images and a quick search using this classification.

In addition, images isn't the only thing that takes place and grows over time. We have a builds. In case of heavy use they will grow and take the place too.

I'm sure in the future we will be faced with the task to remove them from the database.

I'm sure that in the future in front of us will be a challenge to remove them (signatures, tags, builds etc.) from the etcd and if we solve this problem in each case, then in the end it may turn out, the data is scattered in different systems.

We can avoid this if we decide to use an external storage. It does not have to be mongo, but anything with multiple indexes. The mongo first comes to my mind for these purposes.

I think there is a distinction here. Etcd is the configuration for the system. WHAT it should be running and HOW it should run. Builds, while possibly taking up space, are configuration data. We are not storing user information. The system should be able to clean itself up and not be at risk of failure due to "too many things" when those things are normal operations.

Images, on the other hand, can be considered partly configuration (what image do I run with) and partly user data (who signed this, what is the signature, what are the contents). In this case, alternate storage is a good thing. I would also suggest that consolidated external storage of all non-configuration data may not be a good thing. There are so many ways to integrate external data that one solution probably won't fit - not to mention it allows scaling and tuning of individual system. The right thing is the api and integration points for how that data is retrieved. And that's how we enable making cluster level decisions based on external data.

+1 to being able to index data and search on it. But is this any different than other external indexes like logging, metrics, or catalogs?

tl;dr I think configurable manifest storage is good. I do not think it is a whole system solution at this point. This is definitely a topic for the next PM arch call.

@legionus

Copy link
Copy Markdown
Contributor Author

@pweil-

I think there is a distinction here. Etcd is the configuration for the system. WHAT it should be running and HOW it should run. Builds, while possibly taking up space, are configuration data.

As for me the builds is user data. In fact, all the resources described here are the user data and creates a potential problem with the size of the etcd. We are already faced with the problem of size of images and the fact that regular pruning is not enough. Do you really think that the rest of this list won't create same problem ? ))

We can store in etcd identifiers of these objects, but why we need to store the objects themselves ?

@pweil-

pweil- commented Nov 18, 2016

Copy link
Copy Markdown

Do you really think that the rest of this list won't create same problem

I think those resources likely will have the same problem. But I disagree that deployments and builds are user data. If they are then why aren't all replication controllers and pods user data? I don't think you're suggesting we remove RCs and pods though 😄 In that case I think the system should be resilient enough to prune when necessary so that it does not kill storage. Relying on the user to prune something that could crash the system is definitely a short coming.

@smarterclayton

Copy link
Copy Markdown
Contributor

Images, on the other hand, can be considered partly configuration (what image do I run with) and partly user data (who signed this, what is the signature, what are the contents). In this case, alternate storage is a good thing. I would also suggest that consolidated external storage of all non-configuration data may not be a good thing. There are so many ways to integrate external data that one solution probably won't fit - not to mention it allows scaling and tuning of individual system. The right thing is the api and integration points for how that data is retrieved. And that's how we enable making cluster level decisions based on external data.

I don't really make that distinction. We have APIs (which are backed by highly available stores). The data store for content management is the registry storage driver. So we put all content under the storage driver. If we had a different backend for signatures, it would be underneath the API, and the API has a backend.

All clients in the system should talk to APIs. Image signatures, if they aren't content (which we made the argument that they are not) are just an API.

@smarterclayton

Copy link
Copy Markdown
Contributor

etcd3 basically removes the size problem, so we shouldn't be arguing about etcd specifically as a store of large numbers of objects.

@ncdc

ncdc commented Nov 18, 2016

Copy link
Copy Markdown
Contributor

@legionus

But on the other hand we put the signatures in the Image. They also take place and we can't put them into registry storage

I know it's been a while since I looked at the upstream code, but the last time I did, it stored signatures in the registry's storage. Are you referring to something else that we do on top of that?

@legionus

Copy link
Copy Markdown
Contributor Author

@ncdc

I know it's been a while since I looked at the upstream code, but the last time I did, it stored signatures in the registry's storage. Are you referring to something else that we do on top of that?

https://github.com/docker/docker.github.io/blob/master/registry/deprecated.md
distribution/distribution#1687

@ncdc

ncdc commented Nov 18, 2016

Copy link
Copy Markdown
Contributor

Thanks

On Fri, Nov 18, 2016 at 4:12 PM, Alexey Gladkov [email protected]
wrote:

@ncdc https://github.com/ncdc

I know it's been a while since I looked at the upstream code, but the last
time I did, it stored signatures in the registry's storage. Are you
referring to something else that we do on top of that?

https://github.com/docker/docker.github.io/blob/master/
registry/deprecated.md
distribution/distribution#1687
distribution/distribution#1687

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#11925 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAABYqSLby05ZIkNrZCTTIGMoiOPKEnEks5q_hSrgaJpZM4KzBoV
.

@legionus

Copy link
Copy Markdown
Contributor Author

@smarterclayton

All clients in the system should talk to APIs. Image signatures, if they aren't content (which we made the argument that they are not) are just an API.

No-no! You do not understand me. I don't propose to use external storage instead of our API.

I suggest to store only certain data in external storage. The data which occupy a lot of space, grow quickly and to which we often make queries. Our API will remain unchanged. It will only be an internal change.

@legionus

Copy link
Copy Markdown
Contributor Author

@pweil-

But I disagree that deployments and builds are user data. If they are then why aren't all replication controllers and pods user data?

To add/delete a replication controller or pod you need special permission.
To make build make build you don't need such permissions. This data will grow much faster.

@legionus

Copy link
Copy Markdown
Contributor Author

re[test]

@0xmichalis

Copy link
Copy Markdown
Contributor

#11873 [test]

@smarterclayton

Copy link
Copy Markdown
Contributor

Will respond more on Monday. In general anything we use to store content
in the registry is either the driver or an API. I don't want a second
abstraction for storage, because that moves the registry in a different
direction.

We aren't going to have an alternate db we access directly from the
registry, because there's no content it can store better than the current
driver, and anything else by definition would be behind an API (our API).
We might eventually have a different store behind our API, but that's a
bigger discussion and a long way out.

On Nov 18, 2016, at 6:19 PM, Michail Kargakis [email protected]
wrote:

#11873 #11873 [test]

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#11925 (comment),
or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABG_pxhkPx7hfOw82uphxPx9Caacsjyjks5q_jIrgaJpZM4KzBoV
.

@legionus

Copy link
Copy Markdown
Contributor Author

@soltysh yes. this test from #12182. PR broken.

@legionus legionus changed the title [WIP] Remove manifest from Image Remove manifest from Image Jan 3, 2017
imageSize = 1024
)

var _ = g.Describe("[registry][migration] manifest migration from etcd to registry storage", func() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add this test to the default test set in conformance and core (by adding a new reflex entry) so it always runs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(That is, if it isn't already being run by the conformance tests)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add this test to the default test set in conformance and core (by adding a new reflex entry) so it always runs.

@smarterclayton done

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin testextended up to 16a4cbe

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin test up to 16a4cbe

@openshift-bot

Copy link
Copy Markdown
Contributor

continuous-integration/openshift-jenkins/testextended SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin_extended/948/) (Base Commit: 13fbae5) (Extended Tests: core(from etcd to registry storage))

@openshift-bot

Copy link
Copy Markdown
Contributor

@mfojtik

mfojtik commented Jan 10, 2017

Copy link
Copy Markdown
Contributor

[merge]

(the QE tested the fork_ami and found no issue, they were not testing the upgrade scenario)

@mfojtik

mfojtik commented Jan 10, 2017

Copy link
Copy Markdown
Contributor

@smarterclayton FYI

@mfojtik

mfojtik commented Jan 10, 2017

Copy link
Copy Markdown
Contributor

@ncdc I hope this won't break the rebase PR that much, but I don't want to hold this off longer.

@ncdc

ncdc commented Jan 10, 2017 via email

Copy link
Copy Markdown
Contributor

@mfojtik

mfojtik commented Jan 10, 2017

Copy link
Copy Markdown
Contributor

@ncdc I don't expect this to break things a lot (no changes to deps and it is pretty isolated to registry code/image api). just a "big" change enough to give headsup :)

@soltysh

soltysh commented Jan 10, 2017

Copy link
Copy Markdown
Contributor

I told him 😉

@mfojtik

mfojtik commented Jan 10, 2017

Copy link
Copy Markdown
Contributor

blame @soltysh for panicking.

@mfojtik

mfojtik commented Jan 10, 2017

Copy link
Copy Markdown
Contributor
	imageimporter_test.go:946: unexpected object: unversioned.Status{TypeMeta:unversioned.TypeMeta{Kind:"", APIVersion:""}, ListMeta:unversioned.ListMeta{SelfLink:"", ResourceVersion:""}, Status:"Failure", Message:"Internal error occurred: Get https://registry.access.redhat.com/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)",

seems like RH registry outage. [merge]

@ncdc

ncdc commented Jan 10, 2017

Copy link
Copy Markdown
Contributor

registry outage again [merge]

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin merge up to 16a4cbe

@openshift-bot

openshift-bot commented Jan 10, 2017 •

Copy link
Copy Markdown
Contributor

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/12726/) (Base Commit: f4ca6cf) (Image: devenv-rhel7_5649)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.