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

Set deserialization cache size based on target memory usage #34000

Merged
merged 1 commit into from
Oct 5, 2016

Conversation

wojtek-t
Copy link
Member

@wojtek-t wojtek-t commented Oct 4, 2016

Special notes for your reviewer:

This is the PR we talked about yesterday.

Release note:

To reduce memory usage to reasonable levels in smaller clusters, kube-apiserver now sets the deserialization cache size based on the target memory usage.

This change is Reviewable

@wojtek-t wojtek-t added the release-note-none Denotes a PR that doesn't merit a release note. label Oct 4, 2016
@wojtek-t wojtek-t added this to the v1.4 milestone Oct 4, 2016
@k8s-github-robot k8s-github-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Oct 4, 2016
// target memory usage.
glog.V(2).Infof("Initalizing deserialization cache size based on %dMB limit", s.TargetRAMMB)

// This is the heuristics that from memory capacity is trying to infer
Copy link
Member Author

Choose a reason for hiding this comment

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

@k8s-ci-robot
Copy link
Contributor

Jenkins GCI GCE e2e failed for commit 7852734. Full PR test history.

The magic incantation to run this job again is @k8s-bot gci gce e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

DeserializationCacheSize: DefaultDeserializationCacheSize,
// Default cache size to 0 - if unset, its size will be set based on target
// memory usage.
DeserializationCacheSize: 0,
Copy link
Member

Choose a reason for hiding this comment

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

This will break federation apiserver if they use this cache?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

// on that value.
// From our documentation, we officially recomment 120GB machines for
// 2000 nodes, and we scale from that point. Thus we assume ~60MB of
// capacity per node.
Copy link
Member

Choose a reason for hiding this comment

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

our max object size is 900kb, IIRC. I would suggest an alternate heuristic, which is to decide e.g. 1/3 of this memory will be used for the deserialization cache, and then divide by the max object size to see how big the cache should be.

(It would of course be better to just actually measure the collective sizes of the objects in the cache but that's much much harder. A TODO mentioning this might be good.)

Copy link
Member Author

Choose a reason for hiding this comment

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

I also considered it (when thinking about it for the sizes of caches in "Cacher"), but decided that it's not the best option for now. First of all, because the target memory is not super accurate now (it actually is more-or-less target memory for all components on master machine). Second, because it will result in waaaaay bigger memory usage for larger clusters, which is also not very good in my opinion.

So I would prefer to leave it as is (especially since we want to cherrypick) and probably solve it better later (for 1.5 maybe?). [Though I extended the TODO so that it contains what you basically wrote].

Copy link
Member

Choose a reason for hiding this comment

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

OK, I think we should probably reconsider in the future (it would be good to explicitly set how much memory is allowed for this, so admins get predictable usage) but I guess this is still a big improvement, so I won't block it over this.

@jessfraz
Copy link
Contributor

jessfraz commented Oct 4, 2016

shouldn't this have a release note for the changelog for 1.4.1

@lavalamp lavalamp added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Oct 4, 2016
@lavalamp
Copy link
Member

lavalamp commented Oct 4, 2016

I updated the release note in the OP

@jessfraz
Copy link
Contributor

jessfraz commented Oct 5, 2016

thanks!

@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Oct 5, 2016
@k8s-ci-robot
Copy link
Contributor

Jenkins GCE Node e2e failed for commit 2bfcb1a. Full PR test history.

The magic incantation to run this job again is @k8s-bot node e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@@ -82,6 +82,10 @@ func Run(s *options.ServerRunOptions) error {
// TODO: register cluster federation resources here.
resourceConfig := genericapiserver.NewResourceConfig()

if s.StorageConfig.DeserializationCacheSize == 0 {
// When size of cache is not explicitly set, set it to 50000
s.StorageConfig.DeserializationCacheSize = 50000
Copy link
Member

Choose a reason for hiding this comment

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

@quinton-hoole @nikhiljindal how much memory do you expect federation apiserver to consume?

@lavalamp
Copy link
Member

lavalamp commented Oct 5, 2016

/lgtm

@k8s-github-robot k8s-github-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 5, 2016
@jessfraz
Copy link
Contributor

jessfraz commented Oct 5, 2016

@k8s-bot test this issue #32430

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit bd3664c into kubernetes:master Oct 5, 2016
@jessfraz
Copy link
Contributor

jessfraz commented Oct 5, 2016

@wojtek-t does this need a cherrypick PR to 1.4

@jessfraz jessfraz added the cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. label Oct 6, 2016
@wojtek-t
Copy link
Member Author

wojtek-t commented Oct 6, 2016

@jessfraz - yes we want this cherrypick. I've opened #34213

@jessfraz
Copy link
Contributor

jessfraz commented Oct 6, 2016

thanks!

k8s-github-robot pushed a commit that referenced this pull request Oct 6, 2016
…00-upstream-release-1.4

Automatic merge from submit-queue

Cherrypick: Set deserialization cache size based on target memory usage

Cherrypick of #34000

**Release note**:

```release-note
To reduce memory usage to reasonable levels in smaller clusters, kube-apiserver now sets the deserialization cache size based on the target memory usage.
```

@lavalamp - FYI
@k8s-cherrypick-bot
Copy link

Commit found in the "release-1.4" branch appears to be this PR. Removing the "cherrypick-candidate" label. If this is an error find help to get your PR picked.

@wojtek-t wojtek-t deleted the set_cache_size branch November 23, 2016 14:54
shyamjvs pushed a commit to shyamjvs/kubernetes that referenced this pull request Dec 1, 2016
…ck-of-#34000-upstream-release-1.4

Automatic merge from submit-queue

Cherrypick: Set deserialization cache size based on target memory usage

Cherrypick of kubernetes#34000

**Release note**:

```release-note
To reduce memory usage to reasonable levels in smaller clusters, kube-apiserver now sets the deserialization cache size based on the target memory usage.
```

@lavalamp - FYI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants