-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
server/heapprofiler: don't conside "goIdle" memory
Base decisions about whether to take a heap profile or not on RSS - goIdle, not RSS alone. goIdle is memory allocated from the OS that's not actually in use. I've seen it be up to several gigs. The rationale behind the patch is that we want profiles when the heap is large more than when the RSS is large. I'm looking at a case where we took a heap profile when the heap was 4.5 gigs with 2 gigs idle and then never took one again because of how the heuristic works. And then we OOMed when the heap was larger and the idle space was lower, but the RSS was about the same. With this patch, we would have taken a profile at a more interesting time. I've also further changed the profile collection policy slighly: before, once we got above the 85% threshold, we wouldn't take another profile until we go below it and then again above it. With this patch, you take one profile a minute while you're above 85%, period. Seems simpler and it has a chance of catching some further heap increases. Release note: None
- Loading branch information
1 parent
cf0e3e9
commit 841a2ff
Showing
5 changed files
with
184 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright 2018 The Cockroach Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
// implied. See the License for the specific language governing | ||
// permissions and limitations under the License. | ||
|
||
package base | ||
|
||
import "time" | ||
|
||
// GoMemStats represents information from the Go allocator. | ||
// All units are bytes. | ||
type GoMemStats struct { | ||
// GoAllocated is bytes of allocated heap objects. | ||
GoAllocated uint64 | ||
// GoIdle is space allocated from the OS but not used. | ||
GoIdle uint64 | ||
// GoTotal is approximately GoAllocated + GoIdle (it also includes stacks and | ||
// other things not included in GoAllocated). | ||
GoTotal uint64 | ||
|
||
// Collected is the timestamp at which these values were collected. | ||
Collected time.Time | ||
} | ||
|
||
// MemStats groups HeapStats and an rss measurement (rss referring to the whole | ||
// process, beyond the Go parts). | ||
type MemStats struct { | ||
Go GoMemStats | ||
RSSBytes uint64 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.