-
Notifications
You must be signed in to change notification settings - Fork 990
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
chore: Add --allocator_tracker
for default tracking
#3901
Merged
Merged
Conversation
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
Before, in order to use allocation tracker, one had to issue a `MEMORY TRACK` command. This flag is identical to that, but allows starting Dragonfly with certain ranges without issuing a command. While here, fix a bug. Apparently, `absl::InlinedVector<>` has a bug in the implementation of `max_size()` and so in practice we did not limit the number of trackers. I switched to use `capacity()` instead, which I tested and it works well. Notes: 1. Currently the flag always add 100% "sampling", we can extend that in the future if need be 2. I added the flag in `dfly_main.cc` with custom initialization, because it's low level, and I couldn't get it reasonably working with changes only to `allocation_tracker.cc`
adiholden
reviewed
Oct 10, 2024
@@ -547,6 +549,40 @@ bool UpdateResourceLimitsIfInsideContainer(io::MemInfoData* mdata, size_t* max_t | |||
|
|||
#endif | |||
|
|||
void SetupAllocationTracker(ProactorPool* pool) { | |||
string flag = absl::GetFlag(FLAGS_allocation_tracker); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DFLY_ENABLE_MEMORY_TRACKING must be defined for adding allocation tracking
adiholden
reviewed
Oct 10, 2024
src/server/dfly_main.cc
Outdated
@@ -73,6 +73,8 @@ ABSL_FLAG(string, unixsocketperm, "", "Set permissions for unixsocket, in octal | |||
ABSL_FLAG(bool, force_epoll, false, | |||
"If true - uses linux epoll engine underneath. " | |||
"Can fit for kernels older than 5.10."); | |||
ABSL_FLAG(string, allocation_tracker, "", | |||
"Allocation ranges to log. Format is min:max,min:max,...."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe
Print stack trace of allocation within ranges
adiholden
approved these changes
Oct 13, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before, in order to use allocation tracker, one had to issue a
MEMORY TRACK
command. This flag is identical to that, but allows starting Dragonfly with certain ranges without issuing a command.While here, fix a bug. Apparently,
absl::InlinedVector<>
has a bug in the implementation ofmax_size()
and so in practice we did not limit the number of trackers. I switched to usecapacity()
instead, which I tested and it works well.Notes:
dfly_main.cc
with custom initialization, because it's low level, and I couldn't get it reasonably working with changes only toallocation_tracker.cc